Header Ads

  • Breaking Now

    What are two ways of creating threads in Java and why so?

    Threads can be created in the following ways :

    -Instantiating a class extending java.lang.Thread class and calling start() method

    -Creating a java.lang.Thread and passing a reference of a class implementing Runnable interface.Then calling start() method on this object.
    As mentioned,Java supports these two mechanisms for Thread creations but second option is preferred as in first case there is a possibility of single inheritance making a thread object less flexible in its behaviour while in second case a thread object can be clubbed with multiple features.


    1. Hi, my name is Tim. Just wanted to say hi to the forum, I been creeping around here for a while now, but tend to participate more. Looking forward to make some new friends. Ciao!


      NY, NY

    2. Howdy i am new on here. I hit upon this board I find It very useful and its helped me a great deal. I hope to contribute & help other people like it has helped me.

      Thanks, See Ya Around

    3. Hi-ya i'm new to this. I stumbled upon this message board I have found It exceedingly helpful & it's helped me out a great deal. I hope to contribute & aid others like it has helped me.

      Thank You, Catch You About.

    4. Sup i'm new here. I hit upon this website I have found It truly helpful and it has helped me a lot. I should be able to contribute & aid other people like its helped me.

      Cheers all, See You About.

    5. Hello.
      The interesting name of a site - www.interviewjava.com, interesting this here is very good.
      I spent 4 hours searching in the network, until find your forum!

    6. Extend threading
      Runnable Threading
      ..r d 2 types og threading


    Post Top Ad

    Post Bottom Ad