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