Originally posted by Mani:
Which of the following statements are true?
1) An interface can only contain method and not variables
2) Java does not allow the creation of a reference to an interface with the new keyword.
3) A class may extend only one other class and implement only one interface
4) Interfaces are the Java approach to addressing its single inheritance model, but require implementing classes to create the functionality of the Interfaces.
Ans given is 4)
I think choice 2 is also correct.
Java won't allow creation of the reference of an interface with new keyword. Actually if we do so we won't get the reference to the interface but will get reference to an anonymous inner class which implements the interface. Correct me if I am wrong.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!https://www.kickstarter.com/projects/paulwheaton/low-tech