题目内容

试完成下述程序片段:public class Point(){ int x,y;public Point(int x,int y){ =x; =y;}......}

A. Point.x Point.y
B. 无解
C. x1 y1
D. this.x this.y

查看答案
更多问题

下列哪个方法不属于播放声音的方法?

A. loop()
B. stop()
C. start()
D. play()

以下程序的调试结果为?class Base{public final void amethod(){System.out.println("amethod");}}public class Fin extends Base{public static void main(String argv[]){Base b = new Base();b.amethod();}}

A. 编译指示带有final 方法的类自己必须定义为final
B. 编译指示不能继承含有final 方法的类
C. 运行错误,原因是Base类没有定义为final类
D. 运行输出 amethod

考虑如下代码:
class Tree{}
class Pine extends Tree{}
class Oak extends Tree{}
public class Forest {
public static void main(String[] args ) {
Tree tree = new Pine();
if(tree instanceof Pine )
System.out.println("Pine" );
if(tree instanceof Tree )
System.out.println("Tree" );
if(tree instanceof Oak )
System.out.println("Oak" );
else
System.out.println("Oops" );
}
}
则输出结果中有哪些?

A. Pine B.Tree C.Forest D.Oops E.无输出

编译和运行以下程序结果为:
1: public class Q21 {
2: int maxElements;
3: void Q21() {
4: maxElements = 100;
5: System.out.println(maxElements);
6: }
7: Q21(int i) {
8: maxElements = i;
9: System.out.println(maxElements);
10: }
11: public static void main(String[] args) {
12: Q21 a = new Q21();
13: Q21 b = new Q21(999);
14: }
15: }

A. 输出100 和 999.
B. 输出999 和 100.
C. 第2行出现编译错误,变量 maxElements未初始化.
D. 12行出现编译错误.

答案查题题库