题目内容

1、以下接口定义,正确的是()。

A. interface A {void print(){};}
B. abstract interface A {void print();}
C. abstract interface A extends J1, J2{ //J1、J2是已定义的接口abstract void print(){};}
D. interface A {void print();}

查看答案
更多问题

2、下列程序中定义了一个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

3、以定以下Java代码,不可以填入下划线处的语句是()。public interface Shape{}class TwoDemension implements Shape{}class Circle extends TwoDemension {}class Triangle extends TwoDemension {}public class Test{public static void main(String[] args) {________}}

A. Shape shape = new Shap();
B. TwoDemension circle = new Circle();
C. Shape shape = new TwoDemension();
D. TwoDemension triangle = new Triangle();

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、能够用来修饰interface的有()。

A. public
B. pirvate
C. protected
D. static

答案查题题库