目测楼下形参定义的为整形,当平均值为double时必须2也为double,2.0,才能输出带小数的结果87.5.但是如果直接把形参定义为double,写2也没问题了。如果说的不对,还请大家改正。
2014-12-10
int score=68;
String mark = (score>60) ? "及格":"不及格";
System.out.println("考试成绩如何:"+mark);
String mark = (score>60) ? "及格":"不及格";
System.out.println("考试成绩如何:"+mark);
2014-12-09
boolean a = true; boolean b = false;boolean c = false;boolean d = true;
System.out.println((a && b) + "未通过");
System.out.println((!b || c) + "通过");
System.out.println((c && d) + "未通过");
System.out.println((d) + "通过");
} }
System.out.println((a && b) + "未通过");
System.out.println((!b || c) + "通过");
System.out.println((c && d) + "未通过");
System.out.println((d) + "通过");
} }
2014-12-09
public class HelloWorld {
public static void main(String[] args) {
String[] hobbys = { "sports", "game", "movie" };
System.out.println("循环输出数组中元素的值:")
for(int i=0;i<hobbys.length;i++){
System.out.println(hobbys[i]);
}
}
}
public static void main(String[] args) {
String[] hobbys = { "sports", "game", "movie" };
System.out.println("循环输出数组中元素的值:")
for(int i=0;i<hobbys.length;i++){
System.out.println(hobbys[i]);
}
}
}
2014-12-09
终于做出来了:
three = one + two;
System.out.println(three);
three += one;
System.out.println(three);
three -= one;
System.out.println(three);
three *= one;
System.out.println(three);
three /= one;
System.out.println(three);
three %= one;
System.out.println(three);
three = one + two;
System.out.println(three);
three += one;
System.out.println(three);
three -= one;
System.out.println(three);
three *= one;
System.out.println(three);
three /= one;
System.out.println(three);
three %= one;
System.out.println(three);
2014-12-09