System.out.println(5/2);
//Output result: 2
double num = 2.5 ;
switch(num){
case 2.5:
System.out.println("2.5");
break;
default:
System.out.println("2.Other than 5");
break;
}
//Compile error
//Incompatible type: irreversible conversion from double to int
An infinite loop is created by omitting the conditional expression of the for statement.
for(int i=0;/*this part*/;i++){
System.out.print(i);
}
//Output result: 012345678910........
Recommended Posts