Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Marcus Green: incorrect answer?

 
Vad Fogel
Ranch Hand
Posts: 504
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What will happen when you attempt to compile and run this code?

1) Compilation and output of count from 0 to 99
2) Compilation and no output
3) Compile time error: class Runt is an abstract class. It can't be instantiated.
4) Compile time error, method start cannot be called directly

Well, I guess this should've been none of the above because technically speaking Runt is all but abstract. Here's the compiler error:

Chapter 7) Threads
 
Jose Botella
Ranch Hand
Posts: 2120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you Vad.
 
Jeff Bosch
Ranch Hand
Posts: 805
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right, Vad -
There's no implementation of run() in Runt, so it must be declared abstract (which it isn't). I can see where the author may say that (3) is correct, except for the missing abstract declaration.
Correct answer: none of the above.
Good catch!
[ October 06, 2003: Message edited by: Jeff Bosch ]
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you identify this question either the static page url and question no or id given if it is from a database.
Marcus
 
Vad Fogel
Ranch Hand
Posts: 504
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marcus, it's Question 1 right under the Quiz header in Chapter 7 (Threads), and here's the hyperlink:
Threads Section
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic