现有:t是一个合法的Thread对象的引用,并且t的合法run()方法如下: public void run() { System.out.print ("go"); } 及: t.start(); t.start(); t.run(); 哪一个是结果?()
第1题:
A、wouldn't go to
B、can't go
C、won't go
第2题:
A.go
B.编译失败
C.代码运行,无输出结果
D.运行时异常被抛出
第3题:
A.go
B.gogo
C.gogogo
D.go之后跟着一个异常
第4题:
A.gogo
B.gogogo
C.go之后跟着一个异常
D.gogo之后跟着一个异常
第5题:
1. public class GoTest { 2. public static void main(String[] args) { 3. Sente a = new Sente(); a.go(); 4. Goban b = new Goban(); b.go(); 5. Stone c = new Stone(); c.go(); 6. } 7. } 8. 9. class Sente implements Go { 10. public void go() { System.out.println(”go in Sente.”); } 11. } 12. 13. class Goban extends Sente { 14. public void go() { System.out.println(”go in Goban”); } 15. } 16. 17. class Stone extends Goban implements Go { } 18. 19. interface Go { public void go(); } What is the result?()
第6题:
t 是一个合法的 Thread 对象的引用,并且 t 的合法 run() 方法如下: public void run() { System.out.print("go "); } 及: t.start(); t.start(); t.run(); 哪一个是结果?()
第7题:
Which three will compile and run without exception?()
第8题:
class Thread2 implements Runnable { void run() { System.out.print("go "); } public static void main(String [] args) { Thread2 t2 = new Thread2(); Thread t = new Thread(t2); t.start(); } } 结果为()
第9题:
go
编译失败
代码运行,无输出结果
运行时异常被抛出
第10题:
private synchronized Object o;
void go() {synchronized() { /* code here */ }
public synchronized void go() { /* code here */ }
private synchronized(this) void go() { /* code here */ }
void go() {synchronized(Object.class) { /* code here */ }
void go() {Object o = new Object();synchronized(o) { /* code here */ }
第11题:
Compilation fails.
An exception is thrown at runtime.
The code executes normally and prints „foo”.
The code executes normally, but nothing is printed.
第12题:
go
运行时异常被抛出
代码运行,无输出结果
编译失败
第13题:
If it rains tomorrow, we()out for a picnic.
A. wouldn't go
B. can't go
C. won't go
第14题:
I want to go to the dentist, but you ______ with me.
A、need not to go
B、do not need go
C、need not go
D、need go not
第15题:
A.go
B.编译失败
C.代码运行,无输出结果
D.运行时异常被抛出
第16题:
第17题:
现有: class Thread2 implements Runnable { void run() { System.out.print("go "); } public static void main(String [] args) { Thread2 t2 = new Thread2(); Thread t = new Thread(t2); t.start(); } } 结果为:()
第18题:
1. class MyThread implements Runnable { 2. public void run() { 3. System.out.print("go "); 4. } 5. 6. public static void main(String [] args) { 7. // insert code here 8. t.start(); 9. } 10. } 和如下四句: Thread t = new MyThread(); MyThread t = new MyThread(); Thread t = new Thread(new Thread()); Thread t = new Thread(new MyThread()); 分别插入到第5行,有几个可以通过编译?()
第19题:
public class Threads4 { public static void main (String[] args) { new Threads4().go(); } public void go() { Runnable r = new Runnable() { public void run() { System.out.print(”foo”); } }; Thread t = new Thread(r); t.start(); t.start(); } } What is the result?()
第20题:
go
编译失败
代码运行,无输出结果
运行时异常被抛出
第21题:
go go
go go go
go之后跟着一个异常
go go之后跟着一个异常
第22题:
go
go go
go go go
go 之后跟着一个异常
第23题:
go
编译失败
代码运行,无输出结果
运行时异常被抛出