Untitled

Posted on April 19, 2010, 10:08 am UTC anonymously (about 1 year ago)

Code (highlighted for Java)

  1.   public static int foo;
  2.  
  3.   int bla = FileIO.executeThreadTest();
  4.   System.out.println(bla); // liefert 0
  5.  
  6.   // Starts threadTest() with another Thread
  7.   public static int executeThreadTest() {
  8.     new Thread(new Runnable() {
  9.             public void run() {
  10.               foo = threadTest();
  11.             }
  12.         }).start();
  13.     return foo;
  14.   }
  15.  
  16.   private static int threadTest(){
  17.     int returnValue = 111;
  18.    
  19.     return returnValue;
  20.   }