What if we call Java run() method directly instead start() method?
FileName: TestCallRun1.java Test it NowOutput: running... Problem if you direct call run() method FileName: TestCallRun2.java Test it NowOutput: 1 2 3 4 1 2 3 4 As we can see in the above program that there is no context-switching because here t1 and t2 will be treated as normal object not thread object. Next TopicJava join() Method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India