boolean a = true; // a同意
boolean b = false; // b反对
boolean c = false; // c反对
boolean d = true; // d同意
System.out.println((a&&b)+" 未通过");
System.out.println((a||b)+" 通过");
System.out.println((!d)+" 未通过");
System.out.println((b^d)+" 通过");
}
}
boolean b = false; // b反对
boolean c = false; // c反对
boolean d = true; // d同意
System.out.println((a&&b)+" 未通过");
System.out.println((a||b)+" 通过");
System.out.println((!d)+" 未通过");
System.out.println((b^d)+" 通过");
}
}
2015-07-06
double heightAvg1=176.2;
int heightAvg2=176;
System.out.println(heightAvg1);
System.out.println(heightAvg2);
int heightAvg2=176;
System.out.println(heightAvg1);
System.out.println(heightAvg2);
2015-07-06
double heightAvg1=176.2;
double heightAvg2=heightAvg1;
System.out.println(heightAvg1);
System.out.println(heightAvg2);
double heightAvg2=heightAvg1;
System.out.println(heightAvg1);
System.out.println(heightAvg2);
2015-07-06
double avg1=78.5;
int rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
int rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
2015-07-06
String city="青岛";
System.out.println("我的家乡在:"+city);
System.out.println("我的家乡在:"+city);
2015-07-06
String name="爱慕课";
char sex='男';
int num=18;
double price=120.5;
boolean isOK=true;
char sex='男';
int num=18;
double price=120.5;
boolean isOK=true;
2015-07-06
for(;score <60;count++){
score = score+1;
}
//打印输出加分后成绩,以及加分次数
System.out.println("加分后成绩:"+score);
System.out.println("共加了"+count+"次!");
score = score+1;
}
//打印输出加分后成绩,以及加分次数
System.out.println("加分后成绩:"+score);
System.out.println("共加了"+count+"次!");
int score = 94;
String sex = "女";
if(score>80){
if(sex.equals("参加比赛")){
ystem.out.println("进入女子组决赛");
}
else {
System.out.println("进入男子组决赛");
}
else{
System.out.println("不参加比赛");
}
}
String sex = "女";
if(score>80){
if(sex.equals("参加比赛")){
ystem.out.println("进入女子组决赛");
}
else {
System.out.println("进入男子组决赛");
}
else{
System.out.println("不参加比赛");
}
}
2015-07-06
if(age>60){
System.out.println("老年");
}
else if(age>=40||age<60){
System.out.println("中年");
}
else if(age>=18||age<40){
System.out.println("少年");
}
else {
System.out.println("童年");
}
System.out.println("老年");
}
else if(age>=40||age<60){
System.out.println("中年");
}
else if(age>=18||age<40){
System.out.println("少年");
}
else {
System.out.println("童年");
}
2015-07-06
if(score >80){
if(sex == "女"){
System.out.println("进入女子组决赛");
}else{
System.out.println("进入男子组决赛");
}
}else{
System.out.println("未进入决赛");
if(sex == "女"){
System.out.println("进入女子组决赛");
}else{
System.out.println("进入男子组决赛");
}
}else{
System.out.println("未进入决赛");
2015-07-06
public int sort( int[] scores ){
Arrays.sort(scores);
System.out.println(Arrays.toString(scores));
return scores.length;
}
Arrays.sort(scores);
System.out.println(Arrays.toString(scores));
return scores.length;
}
2015-07-06