Results 1 to 2 of 2
  1. #1
    newbie101 is offline Member
    Join Date
    Aug 2011
    Posts
    2
    Rep Power
    0

    Default "implements from Runnable"

    From the way I understand it, interfaces are just lists of methods that need to be defined elsewhere.However, when people "implements Runnable", they have to create a method called "run()", but then, usually, the body is empty, so, what does implementing from Runnable do if there is no body? Is my understanding of interfaces wrong?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default

    If the body is empty then that Runnable is going to do nothing, so is a little pointless.
    Your first sentence is pretty much correct, though. An interface is essentially a contract that an implementing class agrees to fulfill.

Similar Threads

  1. "extends" and "implements"
    By newbie101 in forum New To Java
    Replies: 6
    Last Post: 02-27-2012, 02:12 PM
  2. Replies: 3
    Last Post: 10-12-2010, 04:21 PM
  3. Replies: 1
    Last Post: 01-21-2010, 09:20 AM
  4. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 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
  •