Is there anything wrong in this question.? Why this stupid solo learner app keep on rejecting it..! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there anything wrong in this question.? Why this stupid solo learner app keep on rejecting it..!

guess the out put. Class MyThread extends Thread{ public void run(int i) { System.out.print ("i"); } } Class ThreadDemo{ public static void main(String[] args){ MyThread t = new MyThread(); t.start(); } No output. is the answer..!

19th Apr 2017, 5:46 PM
ram kumar
ram kumar - avatar
1 Answer
0
explanation : when child thread got initiated it will only execute run method, of MyThread class, with no parameters. As MyThread extends Thread class it also extends empty run method, of Thread Class, with no parameters. So, the run method with parameter "int i" will never get a chance to run. And there will be no out put.
19th Apr 2017, 5:50 PM
ram kumar
ram kumar - avatar