0
1
2
3
第1题:
现有: 1. abstract class Color2 { 2. //insert code here 3. } 4. 5. public class Blue2 extends Color2 { 6.public String getRGB() { return "blue"; } 7. } 和4个声明: public abstract String getRGB(); abstract String getRGB(); private abstract String getRGB(); protected abstract String getRGB(); 分别插入到第2行,有多少行可以编译?()
第2题:
1. public class enclosingone ( 2. public class insideone{} 3. ) 4. public class inertest( 5. public static void main (string[]args)( 6. enclosingone eo= new enclosingone (); 7. //insert code here 8. ) 9. ) Which statement at line 7 constructs an instance of the inner class?()
第3题:
现有: 1. interface Altitude { 2. //insert code here 3. } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?()
第4题:
native public void setTemperature(int kelvin);
private native void setTemperature(int kelvin);
protected int native getTemperature();
public abstract native void setTemperature(int kelvin);
native int setTemperature(int kelvin) {}
第5题:
// just a comment
protected HorseRadish() { }
protected HorseRadish() { this(42);}
protected HorseRadish() { new HorseRadish (42);}
第6题:
BigDog() { super(); this(); }
BigDog() { String name = Fido; super(); }
BigDog() { super(); String name = Fido; }
private BigDog() { super();}
第7题:
process(bytes);
BitUtils.process(bytes);
util.BitUtils.process(bytes);
SomeApp cannot use methods in BitUtils.
import util.BitUtils.*; process(bytes);
第8题:
0
1
2
3
第9题:
0
1
2
3
第10题:
static class InnerOne { public double methoda() {return d1;} }
static class InnerOne { static double methoda() {return d1;} }
private class InnerOne { public double methoda() {return d1;} }
protected class InnerOne { static double methoda() {return d1;} }
public abstract class InnerOne { public abstract double methoda(); }
第11题:
0
1
2
3
第12题:
0
1
2
3
4
第13题:
现有: 1. abstract class Color { 2.protected abstract String getRGB(); 3. } 4. 5. public class Blue extends Color { 6. //insert code here 7. } 和四个声明: public String getRGB() { return "blue"; } String getRGB() { return "blue"; ) private String getRGB() { return "blue"; } protected String getRGB() { return "blue"; ) 分别插入到第6行,有几个可以通过编译?()
第14题:
现有 1. class Calc { 2. public static void main(String [] args) { 3. try { 4. int x = Integer.parselnt ("42a") ; 5. //insert code here 6. System.out.print ("oops"); 7. } 8. } 9. } 下面哪两行分别插入到第五行,会导致输 "oops" ? ()
第15题:
int foo() { /* more code here */ }
void foo() { /* more code here */ }
public void foo() { /* more code here */ }
private void foo() { /* more code here */ }
protected void foo() { /* more code here */ }
第16题:
0
1
2
3
第17题:
doX();
X.doX();
x.X.doX();
x.X myX = new x.X(); myX.doX();
第18题:
public class Circle implements Shape { private int radius; }
public abstract class Circle extends Shape { private int radius; }
public class Circle extends Shape { private int radius; public void draw(); }
public abstract class Circle implements Shape { private int radius; public void draw(); }
public class Circle extends Shape { private int radius;public void draw() {/* code here */} }
public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }
第19题:
0
1
2
3
第20题:
static class InnerOne { public double methoda() { return d1; } }
static class InnerOne { static double methoda() { return d1; } }
private class InnerOne { public double methoda() { return d1; } }
protected class InnerOne { static double methoda() { return d1; } }
public abstract class InnerOne { public abstract double methoda(); }
第21题:
The application will crash.
The code on line 29 will be executed.
The code on line 5 of class A will execute.
The code on line 5 of class B will execute.
The exception will be propagated back to line 27.
第22题:
this.commission = commission;
superb(); commission = commission;
this.commission = commission; superb();
super(name, baseSalary); this.commission = commission;
super(); this.commission = commission;
this.commission = commission; super(name, baseSalary);
第23题:
1
2
3
4
第24题:
int gap() { return 7; }
public int gap() { return 7; }
private int gap(int x) { return 7; }
protected Creb gap() { return this; }
public int gap() { return Integer.getInteger (42); }