• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

OO Concept

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the following statement true :

Final and private methods are never inherited into subclass when extended.
On the other hand abstract and static methods are inherited.





How do we know something is inherited, no access or just hidden ?

Thanks,
Eleanor
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eleanor,

I think the statement is true. static methods and variables are in a sense inherited, but not in the same strong sense that instance variables and methods are But i didn't really get your question.Do you mean that is there a way to identify whether something can be inherited or not?
[ September 05, 2006: Message edited by: omar salem ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eleanor Leong:
Is the following statement true :

Final and private methods are never inherited into subclass when extended.
On the other hand abstract and static methods are inherited...


  • final methods are inherited, but cannot be overridden.
  • private methods are not visible to the subclass.
  • abstract methods are inherited (otherwise, they couldn't be implemented).
  • static methods are inherited, but cannot be overridden (although they can be "hidden").
  • While preparing for the SCJP exam, I suggest that you write lots of code to test/verify concepts like this.
    [ September 05, 2006: Message edited by: marc weber ]
     
    Greenhorn
    Posts: 20
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Eleanor,

    You can read more about "Overriding and Hiding" here.
     
    Catch Ernie! Catch the egg! And catch this tiny ad too:
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic