thinkinterview » interview questions
« Previous

interview Questions

next »
question What is interface? Does Java support multiple inheritance? If yes then how?
Answer Description: An Interface is implicitly abstract and public. Interfaces with empty bodies are called marker interfaces having certain property or behavior. Examples:java.lang.Cloneable,java.io.Serializable,java.util.EventListener. An interface body can contain constant declarations, method prototype declarations, nested class declarations, and nested interface declarations.

Interfaces provide support for multiple inheritance in Java. A class that implements the interfaces is bound to implement all the methods defined in Interface.


Example:
public interface ExampleInterface {
public void functionOne();
public long CONSTANT_ONE = 1000;
}

Next Queston » Code to convert InputStream into String...

Code to convert InputStream into StringView full queston »


Posted in: Java(30) |