万能百科  > 计算机   > 

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

2021-07-20   

[单项选择题] 下列程序的输出结果是( )。  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。

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签