[单项选择题] 下列程序的输出结果是( )。  interface Inter{  public final static int A=100;  }  class My implements I

14 查阅

[单项选择题] 下列程序的输出结果是( )。  interface Inter{  public final static int A=100;  }  class My implements Inter{  public static void main (String args[ ])  {System.out.println(A) ;  }

A.100

B.0

C. A

D. 程序有错误

参考答案:

A

本题主要考查接口的定义和使用,接口是一种含有抽象方法和常量的一种特殊的抽象类,不能包含成员变量,在程序中是输出常量A的值,所以输出的结果为5。

计算机考试