fork(1) download
  1. public class Fabric extends Thread {
  2.  
  3. public static void main(String[] args) {
  4.  
  5. Thread t = new Thread(new Fabric());
  6.  
  7. Thread t2 = new Thread(new Fabric());
  8.  
  9. t.start();
  10.  
  11. t2.start();
  12.  
  13. }
  14.  
  15. public static void run() {
  16.  
  17. for(int i = 0; i < 2; i++)
  18.  
  19. System.out.print(Thread.currentTread().getName() + " ");
  20.  
  21. }
  22.  
  23. }
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:15: error: run() in Fabric cannot implement run() in Runnable
	public static void run() {
	                   ^
  overriding method is static
Main.java:19: error: cannot find symbol
			System.out.print(Thread.currentTread().getName() + " ");
			                       ^
  symbol:   method currentTread()
  location: class Thread
3 errors
stdout
Standard output is empty