题目内容

运行类C的输出结果为?()class A { public A() { System.out.println( "The default constructor of A is invoked"); }} class B extends A { public B() { System.out.println( "The default constructor of B is invoked"); }} public class C { public static void main(String[] args) { B b = new B(); }}

A. 无任何显示
B. "The default constructor of B is invoked"
C. "The default constructor of A is invoked""The default constructor of B is invoked"
D. "The default constructor of B is invoked""The default constructor of A is invoked"

查看答案
更多问题

下面是People和Child类的定义和构造方法,请选择输出结果class People {String name;public People() { System.out.print(1); }public People(String name) {System.out.print(2);this.name = name;}} class Child extends People {People father;public Child(String name) {System.out.print(3);this.name = name;father = new People(name + ":F");}public Child(){ System.out.print(4); }}

A. 32
B. 312
C. 13
D. 132

程序运行后times的值是()?public class Test { public static void main(String[] args) { Count myCount = new Count(); int times = 0; for (int i=0; i<100; i++) increment(myCount, times); System.out.println("times = "+ times); } public static void increment(Count c, int times) { c.count++; times++; }}class Count { int count; Count(int c) { count = c; } Count() { count = 1; }}A:101B:100C:1D:03.给定如下程序:(B)3. public class Navel {4. private int size = 7;5. private static int length = 3;6. public static void main(String[] args) {7. new Navel().go();8. }9. void go() {10. int size = 5;11. System.out.println(new Gazer().adder());12. }13. class Gazer {14. int adder() { return size * length; }15. }16. }运行结果为?

A. 15
B. 21
C. 抛出异常
D. 由于多个error编译出错

Java语言与C++语言相比,最突出的特点()

A. 面向对象
B. 有类库
C. 高性能
D. 跨平台

以下语句哪个用于创建线程池?()

A. ExecutorService executor = Executors.newCachedThreadPool();
B. ExecutorService executor = Executors.newCachedThreadPool(1);
C. ExecutorService executor = Executors.newCachedThreadPool(2);
D. ExecutorService executor = Executors.newCachedThreadPool(3);

答案查题题库