fork(1) download
  1. class Test {
  2.  
  3. String listOfCities;
  4. String listOfCountries;
  5.  
  6. public static void main(String[] args) {
  7.  
  8. Test t = new Test();
  9.  
  10. new Thread(()-> t.listOfCities = "hi").start();
  11. new Thread(()-> t.listOfCountries = "hello").start();
  12.  
  13. System.out.println(t.listOfCities);
  14. System.out.println(t.listOfCountries);
  15.  
  16. }
  17. }
Success #stdin #stdout 0.22s 33400KB
stdin
Standard input is empty
stdout
hi
hello