学IT就来ACCP教程网
站内公告:
您的位置:ACCP教程网课后作业第二学期java ┳ 内容

java第三章接口课后选择题

时间:2009-07-02 13:48:06 |来源:ACCP教程网 |作者:冰川 |点击:

1.下面的程序中定义了一个java接口,其中包含()处错误。

public interface Utility{
 private int MAX_SIZE=20;
 int MIN_SIZE=10;
 void use(){
  System.out.println("using it");
 }
 private int getSize();
 void setSize(int i);
}

A.1
B.2
C.3
D.4

2.给定如下Java代码,可以填入下划线处的语句是()。(选三项)

public interface Utility{
 class Fourwheeler implements Utility{}
 class Car extends Fourwheeler{}
 class Bus extends Fourwheeler{}
 public class Test{
  public static void main(String[] args) {
   ________
  }
 }
}

A. Utility car=new  Utility();
B.Fourwheeler bus=new Bus();
C.Utility ut=new Utility();
D.Bus bus=new  Fourwheeler();
E.Fourwheeler fw=new Fourwheeler();

3.以下()修饰符用于声明一个类的变量,且该变量的值在运行期始终保持不变。

A.static
B.final
C.static final
D.final static

4.给定下面的Java代码,可以填入下划线处的语句是()。

public interface Constants{
 int MAX=50;
 int MIN=1;
}
public class Test{
 public static void main(String[] args) {
  ______
 }
}

A.Constants con=new Constants();
B.Constants.MAX=100
C.int i=Constants.MAX-Constants.MIN
D.Constants.MIN>0;

5.将公有成员变量MAX是一个int型值,变量的值保持常数值100。在类Constants中,可以使用以下()声明语句来定义这个变量。

A.public int MAX=100;
B.final int MAX =100;
C.public static int MAX=100;
D.public final int MAX=100;

ACCP教程网的参考答案:

1.C
2.ABF
3.CD
4.AC
5.D


顶一下
(0)
0%
踩一下
(1)
100%
上一篇:java第二章继承和多态选择题 下一篇:没有了
loading.. 评论加载中....