+ 4

Can I create Runnable interface as follows?

interface Hi { void run() {} } and then use it. If not then why? Thanks

12th Nov 2017, 6:32 AM
Meharban Singh
Meharban Singh - avatar
2 Answers
+ 1
Why?
13th Nov 2017, 9:43 AM
Meharban Singh
Meharban Singh - avatar
0
threads in java only work with Runnable interface. So your interface won't work. Unless you extend Runnable interface MyRunnable extends Runnable { // code ... }
12th Nov 2017, 10:58 AM
Eligijus Silkartas
Eligijus Silkartas - avatar