Java Programming - Declarations and Access Control - Discussion

Discussion Forum : Declarations and Access Control - General Questions (Q.No. 18)
18.
Which is a valid declaration within an interface?
public static short stop = 23;
protected short stop = 23;
transient short stop = 23;
final void madness(short stop);
Answer: Option
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.

Discussion:
11 comments Page 2 of 2.

Gowtham said:   1 decade ago
Yeah static methods are not allowed then how?
(1)


Post your comments here:

Your comments will be displayed after verification.