标签:
publicclassTestIf{
publicstaticvoid main(String args []){
int i =6;
if(i >5&& i <10){
System.out.println("i的值大于5,小于10");
}
}
}
publicclassTestIf{
publicstaticvoid main(String args []){
int i =5;
if(i <10){
System.out.println("i的值小于10");
}
else{
System.out.println("i的值大于或等于10");
}
}
publicclassTestIf{
publicstaticvoid main(String args []){
int i =-1;
if(i <0){
System.out.println("i为负数");
}
elseif(i++>0){
System.out.println("i为正数");
}
else{
System.out.println("i为0");
}
System.out.println(i);
}
}
publicclassTestSwitch{
publicstaticvoid main(String args[]){
char c =‘a‘;
switch(c){
case‘b‘:
System.out.println(‘b‘);
break;
case‘d‘:
System.out.println(‘d‘);
break;
case‘a‘:
System.out.println(‘a‘);
break;
default:
System.out.println(‘s‘);
}
}
}
标签:
原文地址:http://www.cnblogs.com/arroneve/p/5815371.html