Discussion :: Declarations and Access Control
-
Which is a valid declaration within an interface?
A.
public static short stop = 23;
|
B.
protected short stop = 23;
|
C.
transient short stop = 23;
|
D.
final void madness(short stop);
|
Answer : Option A
Explanation :
(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.
Be The First To Comment