public static void main(String[] args) {
int score = 94;String sex = "女";
if(score > 80){
if(sex == "男")
System.out.println("进入男子组决赛");
else
System.out.println("进入女子组决赛");
}
else
System.out.println("回家洗洗睡吧");
}
int score = 94;String sex = "女";
if(score > 80){
if(sex == "男")
System.out.println("进入男子组决赛");
else
System.out.println("进入女子组决赛");
}
else
System.out.println("回家洗洗睡吧");
}
2015-05-18
public class HelloWorld{
public static void main(String[] args) {
int a=12;
int b=24;
double sum=a+b;
System.out.println("两数之和为:"+sum);
}
}
用double包容int 就能运算了。前面有说过
public static void main(String[] args) {
int a=12;
int b=24;
double sum=a+b;
System.out.println("两数之和为:"+sum);
}
}
用double包容int 就能运算了。前面有说过
2015-05-18
public class HelloWorld{
public static void main(String[] args) {
String name="爱慕课";
char sex='男';
int num=18;
double price=120.5;
boolean isOK=true;
System.out.println(name);
System.out.println(sex);
System.out.printl
public static void main(String[] args) {
String name="爱慕课";
char sex='男';
int num=18;
double price=120.5;
boolean isOK=true;
System.out.println(name);
System.out.println(sex);
System.out.printl
2015-05-18
public class HelloWorld{
public static void main(String[] args) {
String one="我爱慕课网";
String two="www.imooc.com";
System.out.printf(one);
System.out.printf(two);
}
}
public static void main(String[] args) {
String one="我爱慕课网";
String two="www.imooc.com";
System.out.printf(one);
System.out.printf(two);
}
}
2015-05-18
public void calcAvg(double a,double b){
double c=(a+b)/2;
System.out.println("平均分:"+c);
}
double c=(a+b)/2;
System.out.println("平均分:"+c);
}
2015-05-18
// 对Arrays类对数组进行排序
Arrays.sort(scores);
// 使用foreach遍历输出数组中的元素
for ( int score:scores) {
System.out.println(score);
}
}
}
Arrays.sort(scores);
// 使用foreach遍历输出数组中的元素
for ( int score:scores) {
System.out.println(score);
}
}
}
2015-05-17