Java Programming - Declarations and Access Control - Discussion
Discussion Forum : Declarations and Access Control - General Questions (Q.No. 9)
9.
Which three are valid method signatures in an interface?
- private int getArea();
- public float getVol(float x);
- public void main(String [] args);
- public static void main(String [] args);
- boolean setFlag(Boolean [] test);
Answer: Option
Explanation:
(2), (3), and (5). These are all valid interface method signatures.
(1), is incorrect because an interface method must be public; if it is not explicitly declared public it will be made public implicitly. (4) is incorrect because interface methods cannot be static.
Discussion:
14 comments Page 2 of 2.
Mohammed Refeekh said:
1 decade ago
Can have a interface method protected or default?
Adithya said:
1 decade ago
Hi,
Let me know if we can declare main method in an interface ?
Let me know if we can declare main method in an interface ?
Ashvin said:
1 decade ago
Can any one tell that do we generally put psvm in an interface?
Deepak said:
1 decade ago
What a difficult language is this java?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers