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?
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.
Alok s said:
6 years ago
Inside interface any variable you declare.
i.e
By default public static final ..and if u declare any methods it also public and Abstract.
Eg- interface Inf
{
Public static final int a=6;//variable decl
Public abstract m1 ();//decl of method
}
i.e
By default public static final ..and if u declare any methods it also public and Abstract.
Eg- interface Inf
{
Public static final int a=6;//variable decl
Public abstract m1 ();//decl of method
}
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers