Declarations and Access Control

Q1: Which is a valid declaration within an interface?

A public static short stop = 23;

B final void madness(short stop);

C protected short stop = 23;

D transient short stop = 23;

ANS:A - public static short stop = 23;

(A) is valid interface declarations. (B) and (C) are incorrect because interface variables cannot be either protected or transient. (D) is incorrect because interface methods cannot be final or static.



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.