aspose file tools*
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
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--------
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need help in understanding a snippet from "Thinking in Java"