The operator <= is undefined for the argument type(s) boolean, int怎么处理???
publicclassBrithday{publicBrithday(){System.out.println("ThisisaBrithday");}publicBri...
public class Brithday {
public Brithday(){System.out.println("This is a Brithday");}
public Brithday(int year,int month,int day){
this.year = year;
this.month = month;
this.day = day;
}
private int year;
private int month;
private int day;
public int getyear(){return year;}
public void setyear(int year){this.year = year;}
public int getmonth(){return month;}
public void setmonth(int month){this.month = month;}
public int getday(){return day;}
public void setday(int day){this.day = day;}
public void display(){
System.out.println(year);
System.out.println(month);
System.out.println(day);
}
public static boolean main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
Brithday bri1 = new Brithday();
System.out.println("请输入Brithday:");
int year = in.nextInt();
int month = in.nextInt();
int day = in.nextInt();
bri1.setyear(year);
bri1.setmonth(month);
bri1.setday(day);
if(1900<year<=2013 && 1<=month<=12 && 1<=day<=31){
bri1.display();
}
else{ return false;}
in.close();
} 展开
public Brithday(){System.out.println("This is a Brithday");}
public Brithday(int year,int month,int day){
this.year = year;
this.month = month;
this.day = day;
}
private int year;
private int month;
private int day;
public int getyear(){return year;}
public void setyear(int year){this.year = year;}
public int getmonth(){return month;}
public void setmonth(int month){this.month = month;}
public int getday(){return day;}
public void setday(int day){this.day = day;}
public void display(){
System.out.println(year);
System.out.println(month);
System.out.println(day);
}
public static boolean main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
Brithday bri1 = new Brithday();
System.out.println("请输入Brithday:");
int year = in.nextInt();
int month = in.nextInt();
int day = in.nextInt();
bri1.setyear(year);
bri1.setmonth(month);
bri1.setday(day);
if(1900<year<=2013 && 1<=month<=12 && 1<=day<=31){
bri1.display();
}
else{ return false;}
in.close();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询