| shijun's profileJimmy's blogPhotosBlogLists | Help |
|
April 19 (java)关于Runable interfaceIn addition, Runnable provides the means for a class to be active while not subclassing Thread. A class that implements Runnable can run without subclassing Thread by instantiating a Thread instance and passing itself in as the target. In most cases, the Runnable interface should be used if you are only planning to override the run() method and no other Thread methods. This is important because classes should not be subclassed unless the programmer intends on modifying or enhancing the fundamental behavior of the class. 为了避免过度使用继承而对Runable做一些特殊定制。 很多情况下,我们想用线程,但是我们并不想对Thread对象进行基本行为的改变,所以没有必要对Thread进行继承。 TrackbacksThe trackback URL for this entry is: http://riversidezone.spaces.live.com/blog/cns!7FB20F22EAFE715!880.trak Weblogs that reference this entry
|
|
|