Results 1 to 4 of 4
  1. #1
    jenny27 is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default Simple subclass, superclass question

    I'm new to Java but after reading the tutorial docs on their website I can't quite see why this is false (its a question from my learning materials).

    When a subclass extends a superclass, all methods that are contained in the superclass are accessible from the subclass.


    What Is Inheritance? (The Java™ Tutorials > Learning the Java Language > Object-Oriented Programming Concepts)
    "This gives MountainBike all the same fields and methods as Bicycle..."

    So why is this false?


    Please can someone explain this to me?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Simple subclass, superclass question

    Methods can have different "access" modifiers such as public, protected, and.....

    You get my hint?

  3. #3
    jenny27 is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default Re: Simple subclass, superclass question

    aaah private :)

    thanks

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Simple subclass, superclass question

    Exactly! You're welcome!

Similar Threads

  1. Superclass and Subclass Constructor Question
    By achiu17 in forum New To Java
    Replies: 1
    Last Post: 01-30-2012, 06:05 AM
  2. Array of Objects (Superclass containing Subclass)
    By stupidwaldo in forum New To Java
    Replies: 47
    Last Post: 12-12-2011, 02:29 PM
  3. subclass calling superclass method
    By stackptr89 in forum New To Java
    Replies: 10
    Last Post: 11-22-2010, 08:40 PM
  4. superclass and subclass
    By mr idiot in forum New To Java
    Replies: 19
    Last Post: 01-03-2009, 08:29 AM
  5. which class is superclass and subclass?
    By java_fun2007 in forum New To Java
    Replies: 0
    Last Post: 12-11-2007, 09:55 PM

Posting Permissions

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