This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Another Question From JQuest Mock Exam...

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic