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();

}
}

原文链接:Important points for Java interface

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容