+ 2

Why this java program of multithreading not working?

I have used java.lang.Thread here. https://code.sololearn.com/cPq7Q3XpYH81/?ref=app

14th Oct 2018, 5:28 AM
harshit
harshit - avatar
1 Answer
+ 3
The problem is that you defined your own class Thread (the one that contains the main method). You're implementing your self-defined class instead if the Java class Thread (which implements runnable so that you can use it's start method, your self-defined class doesn't implement Runnable, so the start method is unavailable). Rename it and the code works fine.
14th Oct 2018, 6:22 AM
Tashi N
Tashi N - avatar