Declarations and Access Control

Q1: Which is a valid declaration within an interface?

A protected short stop = 23;

B public static short stop = 23;

C transient short stop = 23;

D final void madness(short stop);

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.