File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mysterious Mr. Thread(), Mr. run() and Mr. start()

 
Marcus Deviln
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

...and the answer:

(d) The program will compile without errors and will print out |R1b| once and |R2| twice, in some order, every time the program is run.

Why does "|R2|" print if it doesn't have a run() method? or better yet why does it not need its own run() method for it to print out? Why will "|R2|" print out twice? The author says it will print out in some order- which makes me wonder how is it that it can print in random order? I thought the constructors will be used as they appear from the top down like an instance initializer block.
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
 
Jim Hoglund
Ranch Hand
Posts: 525
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some typos and where is R2 defined?
Can you clean up your code a bit? Thanks.
Jim ... ...
 
Janeice DelVecchio
Saloon Keeper
Posts: 1802
12
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. You still haven't quoted your source. Please do so.
2. There's a compiler error on line 10
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic