1.

How Can We Create An Interface In Java ?

Answer»

To create an interface in Java, we can USE the keyword "interface" followed by the interface NAME.

Example

interface Employee {

int EMPID = 23;

String empname="John";

}

We can implement an interface in a class by USING keyword "implement" and can use ABSTRACT methods.

To create an interface in Java, we can use the keyword "interface" followed by the interface name.

Example

interface Employee {

int empid = 23;

String empname="John";

}

We can implement an interface in a class by using keyword "implement" and can use abstract methods.



Discussion

No Comment Found