This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Need help in understanding a snippet from Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Need help in understanding a snippet from "Thinking in Java"" Watch "Need help in understanding a snippet from "Thinking in Java"" New topic
Author

Need help in understanding a snippet from "Thinking in Java"

Rajkumar Masanaiyan
Greenhorn

Joined: Sep 17, 2011
Posts: 24
In the below snippet, what is so convenient in having everything in the same class. Isn't it the case with classes that extend Thread?

Why is inner class being mentioned suddenly here? What is its relationship with Thread or the current context.

Note: For more context, please refer to the following URL: http://mindview.net/Books/TIJ/DownloadSites

--------snip--------
The convenient aspect about the Runnable interface is that everything belongs to the same class; that is, Runnable allows a mixin in combination with a base class and other interfaces.

If you need to access something, you simply do it without going through a separate object.

However, inner classes have this same easy access to all the parts of an outer class, so member access is not a compelling reason to use Runnable as a mixin rather than an inner subclass of Thread.
--------snip--------
 
Don't get me started about those stupid light bulbs.
 
subject: Need help in understanding a snippet from "Thinking in Java"
 
It's not a secret anymore!