Results 1 to 4 of 4
  1. #1
    nikkka is offline Member
    Join Date
    Mar 2011
    Posts
    45
    Rep Power
    0

    Default What does IMPLEMENTS mean?

    When i want to define .clone() method in superclass, i have to write
    Java Code:
    class SuperClass implements Cloneable
    However if i want to define the same method in some subclass, when the superclass implements Clonable, i don't need anything like that:
    Java Code:
    class SubClass implements Cloneable
    I suppose it's because subclass inherits the "Clonable" option. Is that right? If yes, why does superclass needs it, when it's inherited from the Object class just like subclass is inherited from superclass?

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Quote Originally Posted by nikkka View Post
    When i want to define .clone() method in superclass, i have to write
    Java Code:
    class SuperClass implements Cloneable
    However if i want to define the same method in some subclass, when the superclass implements Clonable, i don't need anything like that:
    Java Code:
    class SubClass implements Cloneable
    I suppose it's because subclass inherits the "Clonable" option. Is that right? If yes, why does superclass needs it, when it's inherited from the Object class just like subclass is inherited from superclass?
    Because Object doesn't implement Cloneable.

    -Gary-

  3. #3
    nikkka is offline Member
    Join Date
    Mar 2011
    Posts
    45
    Rep Power
    0

    Default

    Quote Originally Posted by gcalvin View Post
    Because Object doesn't implement Cloneable.

    -Gary-
    So Object is abstract class? How then I can create Object class objects? :confused: :(
    Thank you! :)

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

    Default

    No.
    It just doesn't implement Cloneable.
    The reason being that not everything needs to be Cloneable, so making Object Cloneable would have been unecessary.

Similar Threads

  1. Interface and implements
    By Bored2 in forum New To Java
    Replies: 27
    Last Post: 11-10-2010, 01:08 PM
  2. implements
    By danghieu in forum New To Java
    Replies: 1
    Last Post: 04-29-2010, 05:52 PM
  3. ButtonWatcher implements ActionListener
    By darkblue24 in forum New To Java
    Replies: 3
    Last Post: 03-05-2010, 06:18 PM
  4. How hibernate implements jpa specification?
    By king9527 in forum Advanced Java
    Replies: 1
    Last Post: 02-05-2010, 10:53 AM
  5. How to implements cryptation in a java
    By paul in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 05:06 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
  •