When I run this program
public class Fabric extends Thread { public static void main(String[] args) { Thread t1 = new Thread(new Fabric());
new Thread(new Fabric());
Since Fabric is a Thread, you created 2 threads here :)
Fabric
JDK8 code:
/* For autonumbering anonymous threads. */ private static int threadInitNumber; private static synchronized int nextThreadNum() { return threadInitNumber++; }