// Creating Thread using Runnable Interface class Task1 implements Runnable{ public void run(){ System.out.println("run function is called by start"); /* these functions will not work as we have not inherited Thread class. So use Thread instead of this. System.out.println(this.currentThread()); */ System.out.println(Thread.activeCount()); } } class Mythread3{ public static void main(String a[]){ Task1 taskobj = new Task1(); Thread t = new Thread(taskobj); t.start(); } } /* run function is called by start Thread[#21,Thread-0,5,main] 2 */