Results 1 to 4 of 4

Thread: threads

  1. #1
    brindha1688 is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

  2. #2
    Join Date
    May 2011
    Location
    Herentals, Belgium
    Posts
    14
    Rep Power
    0

    Default

    Because java doesn't support Multiple Inheritance... You can make a thread by making your class a subclass of Thread(extends Thread), but I your class is already a subclass of something other you cannot use the "extends Thread" any more. In that case there is option 2: Implementing Interface Runnable which let you also create a thread. You are not restricted using Interfaces, a class you create can only extend one superclass, but can Implement more than one Interfaces.

    And hey that what's programming is all about... You can do the simplest thing is way more than one way!!

    If I can give you a hint, focus on the implementing interfaces for creating threads, I find it the best way, u can always use this way!!

    Peace
    Enjoy your milk!! :cool:

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by NatureFreshMilk View Post
    Because java doesn't support Multiple Inheritance... You can make a thread by making your class a subclass of Thread(extends Thread), but I your class is already a subclass of something other you cannot use the "extends Thread" any more.
    That's nothing a little inner class (that extends the Thread class) can't solve ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    Join Date
    May 2011
    Location
    Herentals, Belgium
    Posts
    14
    Rep Power
    0

Similar Threads

  1. Threads and UML
    By JUser in forum Advanced Java
    Replies: 0
    Last Post: 09-27-2010, 08:43 PM
  2. Threads
    By Tanuck in forum New To Java
    Replies: 5
    Last Post: 09-21-2010, 02:44 AM
  3. Threads
    By GoLuM83 in forum Advanced Java
    Replies: 7
    Last Post: 03-31-2010, 08:52 PM
  4. Threads!
    By rameshraj in forum Advanced Java
    Replies: 1
    Last Post: 05-04-2008, 04:11 PM
  5. Using threads
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-11-2007, 10:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •