fork download
  1. public class Fabric extends Thread {
  2.  
  3.  
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Thread t = new Thread(new Fabric());
  8.  
  9. Thread t2 = new Thread(new Fabric());
  10.  
  11. t.start();
  12.  
  13. t2.start();
  14.  
  15.  
  16.  
  17.  
  18. for(int i = 0; i < 2; i++)
  19.  
  20. System.out.print(Thread.currentTread().getName() + " ");
  21.  
  22. }
  23.  
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class Fabric is public, should be declared in a file named Fabric.java
public class Fabric extends Thread {
       ^
Main.java:20: error: cannot find symbol
			System.out.print(Thread.currentTread().getName() + " ");
			                       ^
  symbol:   method currentTread()
  location: class Thread
2 errors
stdout
Standard output is empty