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-07-29
public class HelloWorld {
public static void main(String[] args) {
int one = 20 ;
if (one % 2) == 0;
System.out.println("one是偶数");
}
}
public static void main(String[] args) {
int one = 20 ;
if (one % 2) == 0;
System.out.println("one是偶数");
}
}
2015-07-29
int a=three=one+two;
int b=three+=one;
int c=three-=one;
int d=three*=one;
int e=three/=one;
int f=three%=one;
System.out.println("three=one+two==>"+a);
("three+=one==>"+b);
("three-=one==>"+c);
("three*=one==>"+d);
("three/=one==>"+e);
("three%=one==>"+f);
int b=three+=one;
int c=three-=one;
int d=three*=one;
int e=three/=one;
int f=three%=one;
System.out.println("three=one+two==>"+a);
("three+=one==>"+b);
("three-=one==>"+c);
("three*=one==>"+d);
("three/=one==>"+e);
("three%=one==>"+f);
2015-07-29
public class HelloWorld{
public static void main(String[] args) {
int age1=24;
int age2=18;
int age3=36;
int age4=27;
int sum=age1+age2+age3+age4;
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1;
public static void main(String[] args) {
int age1=24;
int age2=18;
int age3=36;
int age4=27;
int sum=age1+age2+age3+age4;
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1;
2015-07-29
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-07-29
public class HelloWorld{
public static void main(String[] args) {
final String abc= "男";
final String $cba="女";
System.out.println("用户的性别:"+abc);
System.out.println("用户的性别:"+$cba);
}
}
public static void main(String[] args) {
final String abc= "男";
final String $cba="女";
System.out.println("用户的性别:"+abc);
System.out.println("用户的性别:"+$cba);
}
}
2015-07-29
public class HelloWorld{
public static void main(String[] args) {
final String abc="男";
System.out.println("用户的性别:"+abc);
}
}
public static void main(String[] args) {
final String abc="男";
System.out.println("用户的性别:"+abc);
}
}
2015-07-29
1、 > 、 < 、 >= 、 <= 只支持左右两边操作数是数值类型
2、 == 、 != 两边的操作数既可以是数值类型,也可以是引用类型
2、 == 、 != 两边的操作数既可以是数值类型,也可以是引用类型
2015-07-29
public class HelloWorld{
public static void main(String[] args) {
String city="hp";
System.out.println("我的家乡在:"+city);
}
}
public static void main(String[] args) {
String city="hp";
System.out.println("我的家乡在:"+city);
}
}
2015-07-29
public class HelloWorld{
public static void main(String[] args) {
String c="我爱慕课网";
String e="www.imooc.com";
System.out.println(c);
System.out.println(e);
}
}
public static void main(String[] args) {
String c="我爱慕课网";
String e="www.imooc.com";
System.out.println(c);
System.out.println(e);
}
}
2015-07-29
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-29