This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

thread statement is too vague for me

 
Ivy Kho
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been study threads for the scjp using the book by Heller and Roberts, 4th edition and I came across this statement which seems vague (for me). could somebody help me by elaborating or better, by giving an example?

"Putting run() in a subclass of Thread may mean that the method cannot access features it needs (or cannot access those features in a clean, reasonable manner)"
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what that means either. Perhaps the surrounding text gives it more meaning, but the sentence by itself hints at something not immediately apparent to me.

The obvious disadvantage to extending the Thread class is that you cannot extend another class. It doesn't save you much effort, either.

Implementing the Runnable interface is a better solution; I don't think there's much discussion on that point any more. Some people contend that the options are equivalent because they're both 'legal'. That argument to me is a dull and needlessly defensive argument at best.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic