fork download
  1. class Test {
  2. public static void main(String[] args) {
  3.  
  4. String a;
  5. String b;
  6.  
  7. Test t = new Test();
  8.  
  9. new Thread(()-> a = "hi").start();
  10. new Thread(()-> b = "hello").start();
  11.  
  12. System.out.println(a);
  13. System.out.println(b);
  14.  
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: variable a might not have been initialized
	    System.out.println(a);
	                       ^
Main.java:13: error: variable b might not have been initialized
	    System.out.println(b);
	                       ^
Main.java:9: error: local variables referenced from a lambda expression must be final or effectively final
	    new Thread(()-> a = "hi").start();
	                    ^
Main.java:10: error: local variables referenced from a lambda expression must be final or effectively final
	    new Thread(()-> b = "hello").start();
	                    ^
4 errors
stdout
Standard output is empty