xxxxxxxxxx
class MyThread extends Thread {
@Override
public void run() {
System.out.println("In run method; thread name is: " + Thread.currentThread().getName());
}
}
public class ThreadTest {
public static void main(String args[]) {
Thread myThread = new MyThread();
myThread.run(); // #1
System.out.println("In main method; thread name is: " + Thread.currentThread().getName());
}
}
xxxxxxxxxx
Here, I think you are confusing the overloaded term "thread". As correctly pointed out by other answers, a thread usually refers to a "software" concept. But sometimes it is also used as a "hardware" concept. When a "core" has two "threads" (like in many new Intel chips), it means that the core can run two parallel threads, as if there were two cores. This is, however, usually called hyperthreading.