1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

best way for implementing thread in java

Discussion in 'Java' started by khushboo652, Jan 11, 2012.

  1. khushboo652

    khushboo652 Banned

    Joined:
    Jan 9, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    pls give me the answer which is the best way to implement thread in java runnable interface or inheritance and why?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    What all ways you have tried and looking for best amont them?
     
  3. virxen

    virxen New Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0
  4. dagdu

    dagdu New Member

    Joined:
    Feb 8, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    By implementing runnable interface is best way to implement.By implementing we can reuse that thread and we can extends any other useful class.
     
  5. alia123

    alia123 New Member

    Joined:
    Jan 8, 2016
    Messages:
    65
    Likes Received:
    3
    Trophy Points:
    0
  6. RRT2010

    RRT2010 New Member

    Joined:
    Apr 7, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    India
    Also you can see if you require to Synchronize the threads. This may be needed if you have many threads running in parallel to avoid concurrency.
     
  7. ifeeleducation

    ifeeleducation New Member

    Joined:
    Mar 2, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    CEO
    Location:
    Mumbai
    Home Page:
    Use Class is the best way for implementing thread in java
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    On what basis you say it is the best?
     
  9. theglobalassociates

    theglobalassociates New Member

    Joined:
    Apr 5, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    1.Extending Thread Class
    2.Implementing Runnable Class
     

Share This Page