Java

Topic: Abstract Class and Interfaces

How to Declare Interfaces in java?

The interface keyword is used to declare an interface. Here is a simple example to declare an interface:Example:Let us look at an example that depicts encapsulation:/* File name : NameOfInterface.java */import java.lang.*;//Any number of import statementspublic interface NameOfInterface{   //Any number of final, static fields   //Any number of abstract method declarations\}

Browse random answers: