+ 1
Why object called is not defined in the class but program executes anyway when thread is extended?
Hi. In java threads chapter an obj.start is called which is not defined in the class but still the program runs when there is an extended thread. This happens only when ‘start’ is called. Please explain.
2 Respostas
+ 1
If yes, then the method start() is inherited from the Thread class, meaning it is a method of the Thread class. You can google the Java Thread class to see its methods... Anyway, since the class Loader extends Thread it inherits all its public methods as well. So an object of the Loader class can use any of those methods of the Thread class even if that method is not explicitly defined in the Loader class itself.
+ 2
Let's see... Are you talking about this code from the Threads section of the Java course?
https://code.sololearn.com/cMjFAQbjDIP0/?ref=app