Card 40 / 42: Which three will compile and run without exception ?
A)
private synchronized object o;
B)
void go(){ synchronized(){ // code here }
C)
public synchronized void go(){ //code here }
D)
private synchronized (this) void go(){ //code here }
E)
void go(){ synchronized(object.class){ //code here } }
F)
void go(){ synchronized (o){ //code here } }
Answer:
C) public synchronized void go(){ //code here }
E) void go(){ synchronized(object.class){ //code here } }
F) void go(){ synchronized (o){ //code here } }
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
|
Oracle Certified Professional Java Programmer
Author:
JavaChamp TeamSenior Java Developer
QuizOver.com
Germany
Access: |