0
1
2
3
第1题:
此题为判断题(对,错)。
第2题:
第3题:
Which declaration prevents creating a subclass of an outer class?()
第4题:
下列哪个类的声明是正确的()
第5题:
class BaseClass{ private float x= 1.0f; protected void setVar (float f) {x = f;} } class SubClass extends BaseClass { private float x = 2.0f; //insert code here } Which two are valid examples of method overriding?()
第6题:
Static class FooBar{}
Private class FooBar{}
Abstract public class FooBar{}
Final public class FooBar{}
Final abstract class FooBar{}
第7题:
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 */ } }
第8题:
0
1
2
3
第9题:
The program runs and prints nothing.
The program runs and prints “Finally”.
The code comiles. But an exception is thrown at runtime.
The code will not compile because the catch block is missing.
第10题:
0
1
2
3
第11题:
Void setVar(float f) {x = f;}
Public void setVar(int f) {x = f;}
Public void setVar(float f) {x = f;}
Public double setVar(float f) {x = f;}
Public final void setVar(float f) {x = f;}
Protected float setVar() {x=3.0f; return 3.0f; }
第12题:
X
y
j
i
第13题:
第14题:
1. public class Target { 2. private int i = 0; 3. public int addOne() { 4. return ++i; 5. } 6. } And: 1. public class Client { 2. public static void main(String[] args) { 3. System.out.println(new Target().addOne()); 4. } 5. } Which change can you make to Target without affecting Client?()
第15题:
Given classes defined in two different files: 1. package util; 2. public class BitUtils { 3. private static void process(byte[] b) { } 4. } 1. package app; 2. public class SomeApp { 3. public static void main(String[] args) { 4. byte[] bytes = new byte[256]; 5. // insert code here 6. } 7. } What is required at line 5 in class SomeApp to use the process method of BitUtils?()
第16题:
public class X { public X aMethod() { return this;} } public class Y extends X { } Which two methods can be added to the definition of class Y?()
第17题:
Given 1. public class Foo { 2. public static void main (String [] args) } 3. try { return;} 4. finally { Syste.out.printIn (“Finally”);} 5. } 6. } What is the result( )?
第18题:
abstract final class HI{}
abstract private move(){}
protected private number;
public abstract class Car{}
第19题:
process(bytes);
BitUtils.process(bytes);
app.BitUtils.process(bytes);
util.BitUtils.process(bytes);
import util.BitUtils. *; process(bytes);
SomeApp cannot use the process method in BitUtils.
第20题:
abstract final class H1{…}
abstract private move(){…}
protected private number;
public abstract class Car{…}
第21题:
declare reset() using the synchronized keyword
declare getName() using the synchronized keyword
declare getCount() using the synchronized keyword
declare the constructor using the synchronized keyword
declare increment() using the synchronized keyword
第22题:
elm elm elm elm
tree elm elm elm
tree elm tree elm
编译失败
第23题:
Void setVar(float f) {x = f;}
Public void setVar(int f) {x = f;}
Public void setVar(float f) {x = f;}
Public double setVar(float f) {x = f;}
Public final void setVar(float f) {x = f;}
Protected float setVar() {x=3.0f; return 3.0f; }
第24题:
x
y
i
j