1 package samples; 2 3 4 public class Foo { 5 public static String secretField; 6 public static int iValue = 1; 7 8 public static void main(String [] args) throws Throwable { 9 System.out.println("Foo.main(...)"); 10 System.out.println(foo1()); 11 12 System.out.println(foo2(123l)); 13 foo3("ddd"); 14 15 Bar.static_bar(); 16 Bar b = new Bar(); 17 b.bar1(); 18 System.out.println(b.bar2()); 19 System.out.println(b.bar_field); 20 21 long l1 = System.currentTimeMillis(); 22 foo4(); 23 foo4(); 24 foo4(); 25 long l2 = System.currentTimeMillis(); 26 System.out.println("foo4s executed in total of " + (l2-l1) + " ms"); 27 } 28 29 public static double foo1() { 30 secretField = "secretFieldSetByFoo" + iValue; 31 return 0.1d; 32 } 33 public static long foo2(long l1) { 34 System.out.println("foo2: " + secretField + ", " + l1); 35 return -1; 36 } 37 public static void foo3(String s) throws Throwable { 38 System.out.println(s); 39 } 40 41 public static void foo4() { 42 for (int i = 0; i < 1000000; i++) { 44 } 46 47 int l2 = (int)System.currentTimeMillis(); 48 51 return ; 53 } 54 55 61 65 } 69 | Popular Tags |