System.out.println("a等于b:" + (a == b));
System.out.println("a大于b:" + (a > b));
System.out.println("a小于等于b:" + (a <= b));
System.out.println("str1等于str2:" + (str1 == str2));
System.out.println("a大于b:" + (a > b));
System.out.println("a小于等于b:" + (a <= b));
System.out.println("str1等于str2:" + (str1 == str2));
2015-05-05
int sum=age1+age2+age3+age4;
double avg=sum/4;
int minus=age1-age2;
int newAge=--age1;
double avg=sum/4;
int minus=age1-age2;
int newAge=--age1;
2015-05-05
public class HelloWorld{
public static void main(String[] args) {
double avg1=78.5;
int rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
}
}
public static void main(String[] args) {
double avg1=78.5;
int rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
}
}
2015-05-05
public class HelloWorld{
public static void main(String[] args) {
String a ="我爱慕课网";
String b ="www.imooc.com";
System.out.println(a);
System.out.println(b);
}
}
public static void main(String[] args) {
String a ="我爱慕课网";
String b ="www.imooc.com";
System.out.println(a);
System.out.println(b);
}
}
2015-05-05
int sum=0;
int num=2;
do{
sum=sum+num;
num=num+2;
}while(num<=50);
System.out.println("50以内的偶数之和为:"+sum);
int num=2;
do{
sum=sum+num;
num=num+2;
}while(num<=50);
System.out.println("50以内的偶数之和为:"+sum);
2015-05-05
if(score>80){
if(sex.equals("男")){
System.out.println("进入男子组决赛");
}else{
System.out.println("进入女子组决赛");
}
}else{
System.out.println(" 淘汰");}
}
}
if(sex.equals("男")){
System.out.println("进入男子组决赛");
}else{
System.out.println("进入女子组决赛");
}
}else{
System.out.println(" 淘汰");}
}
}
2015-05-04
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if(age>18){
System.out.println("成年");
}else{
System.out.println("未成年");
}
}
}
public static void main(String[] args) {
int age=25;
if(age>18){
System.out.println("成年");
}else{
System.out.println("未成年");
}
}
}
2015-05-04
int one=20;
if(one%2==0){
System.out.println(one是偶数);
}
else{
System.out.println("one是奇数");
}
if(one%2==0){
System.out.println(one是偶数);
}
else{
System.out.println("one是奇数");
}
2015-05-04