0
Why does this code not has output?
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(); } }
3 ответов
+ 9
From what I recall, it is because the run method of the Runnable interface requires no arguments to be passed in. In your case, int i shouldn't be there as a parameter of the run method.
https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html#run--
There maybe any another reason, as I'm not pretty sure about it. :\
+ 1
no return statement
0
theres no output