DEV Community

Anand Singh
Anand Singh

Posted on

Important points for Java interface

interface I1
{
public void show();
//interface tells the class what to do
}
class Test implements I1
//for interface use implements keyword
{
public void show()
//It is necessary to create body of abstract method in child class
{
System.out.println("1");
}

public static void main(String[] args)
{
//We cannot create an object of interface so we have created the object of test class here
Test t=new Test();
t.show();

}
}

Top comments (0)