Hello sir,
How are you?
I have just started the topic of thread and i have one query, i executed that below code its working fine but i have some confusion here in this code
thread.start();
why this line working because according to rule (inheritance) when we create the object of super class(Thread thread

by giving the refrence (thread= new BasicThread1()

of Base class, We can only call or use those methods which are available in Base class and(thread.start()

this method is not available or overriden in base class then why its working fine...
Sir please send me any link or notes where more examples of thread are available by which my basic on this thread topic will become stronger
|
Code:
|
// This class extends Thread
class BasicThread1 extends Thread {
// This method is called when the thread runs
public void run() {
System.out.println("this is BasicThread's run method.");
}
}
class BasicThread2
{
public static void main(String args[])
{
// Create and start the thread
Thread thread = new BasicThread1();
thread.start();// i did't get this line.......
}
} |