wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Another Mock Exam Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Another Mock Exam Question " Watch "Another Mock Exam Question " New topic
Author

Another Mock Exam Question

Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
Question 54.
Which of the following class declaration(s) is(are) true?

A.import java.awt.Button;
import java.lang.Runnable;
public class MyClass extends Button implements Runnable{
public void run(){
//Some valid Code
}
}
B.import java.awt.event.*;
import java.applet.Applet;

public class MyApplet extends Applet,WindowAdapter{
public void windowClosed(WindowEvent we){
//Some Valid Code
}
}
C.import java.lang.Runnable;

public class MyClass implements Runnable{
public void run(){
int i = 10
System.out.println("i = "+i);
}
}
D.import java.awt.event.*;
public class MyClass extends WindowAdapter
implements WindowListener{
public void windowClosed(WindowEvent we){
//Some Valid Code
}
}
Answers given are A and D
but C also compiles correctly
can anyone give any rerasoning for it
should C be correct or not ?


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
jafarali
Ranch Hand

Joined: Jul 15, 2000
Posts: 37

int i=10 => Semicolon is missing
 
Don't get me started about those stupid light bulbs.
 
subject: Another Mock Exam Question
 
Similar Threads
Listeners and Adupters
valiveru mock exam errata, please explain correct answers...
Listeners and Adupters
Another Mock Exam Question
Class declarations