File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Another Question From JQuest Mock Exam... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Another Question From JQuest Mock Exam..." Watch "Another Question From JQuest Mock Exam..." New topic
Author

Another Question From JQuest Mock Exam...

Barbara Dyer-Bennet
Greenhorn

Joined: Sep 14, 2000
Posts: 10
The question reads: What can you write at the comment //A in the following code that writes the word "running" to the standard output?

class RunTest implements Runnable {
���public static void main(String[] args) {
������RunTest rt = new RunTest();
������Thread t = new Thread(rt);
������// A
���}
���public void run() {
������System.out.println("running");
���}
���void go() {
������start(1);
���}
���void start(int i) {
���}
}

The question asks for all valid options:
a. System.out.println("running");
b. t.start();
c. rt.start();
d. rt.start(1);
I get that a is correct, but why so b? The argument list doesn't match.
Thanks,
Barbara
[This message has been edited by Barbara Dyer-Bennet (edited September 17, 2000).]
[This message has been edited by Barbara Dyer-Bennet (edited September 17, 2000).]
[This message has been edited by Barbara Dyer-Bennet (edited September 17, 2000).]
weisheZhao
Greenhorn

Joined: Sep 10, 2000
Posts: 18
refered to
...jdk1.2.2/docs/api/java/lang/Thread.html#start()
public void start()
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
call start() then call run(), so "running" is print out
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Another Question From JQuest Mock Exam...
 
Similar Threads
Question From Jaworski's Mock Test
A suggestion for list of Mock Questions
+= and ++
JQuest Cert Simulation Question
Question From JQuest Mock Exam...