Threads

Q1: Which method must be defined by a class implementing the java.lang.Runnable interface?

A public void start()

B public void run()

C void run()

D void run(int priority)

ANS:B - public void run()

Option B is correct because in an interface all methods are abstract by default therefore they must be overridden by the implementing class. The Runnable interface only contains 1 method, the void run() method therefore it must be implemented. Option A and D are incorrect because they are narrowing the access privileges i.e. package(default) access is narrower than public access. Option C is not method in the Runnable interface therefore it is incorrect.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.