Strategy # 1: extend the
Thread class; this will put the run method in a subclass of Thread and may mean that the method cannot get to the features it needs (
Java 2 Cert. Study Guide,Roberts & Heller, page 203). Can anyone give me a example on how this would limit access?
Strategy # 2: implements Runnable - the good way: because: "The run()method, like any other member method, is allowed to access the private data, and call the private methods, of the class of which it is a member (Java 2 Cert. Study Guide,Roberts & Heller, page 203)."
I'm don't get what they mean, are they saying if you create a instance of the class the run method is in you can then access any private data in it?
Can anyone give a simple example of the two ways, please! What difference would the 2 ways make? I could still create a instance of both classes and access any private data.