1 public class IfTest { 2 3 int x = 0; 4 public static void main(String [] args){ 5 6 int i = 9; 7 8 if (i > 10) { 9 10 i = i - 1; 11 System.out.println(i); 12 } 13 14 if (i < 10) { 15 System.out.println("Smile"); 16 } 17 else { 18 System.out.println("Tomorrow"); 19 } 20 21 if (i == 9) { 22 System.out.println("i = 9"); 23 } 24 25 boolean result; 26 27 for (int j = 0; j < 10; j ++) { 28 result = true; 29 if (result) { 30 System.out.println("true"); 31 } 32 if (!result){ 33 System.out.println("false"); 34 } 35 } 36 37 IfTest it = new IfTest(); 38 it.run(7); 39 it.go(); 40 } 41 42 private void go() { 43 int i = 0; 44 int j = 9; 45 if (i < j) { 46 i = i + 1; 47 } 48 } 49 50 private boolean run(int size) { 51 boolean result = true; 52 53 Integer t = new Integer (9); 54 if (t instanceof Integer ) { 55 t = new Integer (100); 56 } 57 if (result) { 58 System.out.println("Smile"); 59 } 60 61 if (size > 1) { 62 result = false; 63 } 64 else { 65 x = size; 66 } 67 68 return result; 69 } 70 71 72 } 73 | Popular Tags |