1 public class EverythingTest { 2 3 private int i = 0; 4 protected short s = 2; 5 public long l = 9L; 6 private static byte b = 4; 7 protected static float f = 5F; 8 public static double d = 3.09; 9 private char c = 'j'; 10 11 private String st = "hi"; 12 13 public static void main(String [] args){ 14 15 EverythingTest et = new EverythingTest(9); 17 et.run(); 18 } 19 20 public EverythingTest(int x) { 21 init(); 22 } 23 24 private void run(){ 25 26 int [] a = new int [10]; 27 28 for (int i = 0; i < 10; i++) { 29 a[i] = i; 30 } 31 32 int b = a[7]; 33 34 float [] f = {10F, 3F, 4F, 7F}; 35 36 37 float ch = f[2]; 38 39 double du = b + ch; 40 double e = du - ch; 41 double g = e * ch; 42 double h = g / ch; 43 44 print(h); 45 46 boolean truth = false; 47 boolean falsity = !truth; 48 49 int x = 9; 50 print(x); 51 int y = -x; 52 print(y); 53 int z = +y; 54 print(z); 55 56 int j = z++ - 7; 57 print(j); 58 int k = ++z - 7; 59 print(k); 60 61 j = z-- - 7; 62 print(j); 63 k = --z - 7; 64 print(k); 65 66 } 67 68 private void init(){ 69 } 70 71 private void print(int i){ 72 System.out.println(i); 73 } 74 75 private void print(double d){ 76 System.out.println(d); 77 } 78 } 79 | Popular Tags |