View RSS Feed

Recent Blogs Posts

  1. Creating a Thread (implementing Java Runnable Interface)

    by , 11-12-2011 at 05:58 PM (My Java Tips)
    A better way to create a thread in Java is to implement Runnable interface. A thread can be created by extending Java Thread class also. Now the question arises why implementing Runnable interface is a better approach? Answer is, if the thread class you are creating is to be subclass of some other class, it canít extend from the Thread class. This is because Java does not allow a class to inherit from more than one class. In such a case one can use Runnable interface to implement threads.
    ...