CodesJava

Easy learning with example program codes

can we override start method in thread?


start() method

public void start()
It starts thread to begin execution, JVM calls run method of this thread.
IllegalThreadStateException – if the thread was already started.

We can override the start method in thread. But when we class thread.start() method then overrided method will be called which results into no execution of run method. Hence no job will be performed.

So, we do not have to override the start method.

Note: We can call super class start method in overrided start method to invoke run method.

Related Topics:

Please follow and like us:
Posted in Java   

Core Java Tutorial



Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki