• 接口是抽象方法和常量的集合,是一种特殊的抽象类。下面的程序是对接口的操作,请在程序的每条横线处填写一个语句,使程序的功能完整。
    注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
    ______________MyInterface
    {
    public static int NUM=100;
    public abstract void print();
    }
    public class ClassName___________MyInterface
    {
    public void print()
    {
    System.out.println(NUM);
    }
    public static void main(String args[])
    {
    __________________________
    obj .print();
    }
    }

    正确答案:interface     implements     ClassName obj=new ClassName();interface     implements     ClassName bj=new ClassName(); 解析:本题主要考查接口、如何生成一个类的对象知识。解答本题的关键是熟练掌握接口、如何生成一个类的对象知识。在本题中,interface MyInterface语句中的interface的功能是声明接口MyInterface,public class ClassName implements
  • 2021年07月15日 22时00分来自  问答库 >> 计算机类
  • 评论 0
  • 手机玩微博

    手机版 手机端
    Powered by 日新微博 © 2018 - 2020 日新网