Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Questions about the characteristics of static members  RSS feed

 
Shane Jensen
Ranch Hand
Posts: 113
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

1. In Mala Gupta's book for the OCAJP 8 exam, it says on page 70: 'You can't override the static members in a derived class, but you can redefine them'. I understand they can't be overriden. But what does 'redefining' mean in this case? Could anyone give an example of that?

2. In the review notes on page 79, it says 'A top-level class or interface is one that isn't defined within another class or interface'. What does this mean? Does this imply a class or interface that isn't declared within another class or interface becomes top-level? Or am I understanding the meaning of the word 'defining' incorrectly here? Also, why would you not be able to prefix this type of class/interface with the keyword static?

Thanks again for your helpful replies

Regards,
Shane
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shane Jensen wrote:1. In Mala Gupta's book for the OCAJP 8 exam, it says on page 70: 'You can't override the static members in a derived class, but you can redefine them'. I understand they can't be overriden. But what does 'redefining' mean in this case? Could anyone give an example of that?

See this post and this one.

Shane Jensen wrote:2. In the review notes on page 79, it says 'A top-level class or interface is one that isn't defined within another class or interface'. What does this mean? Does this imply a class or interface that isn't declared within another class or interface becomes top-level? Or am I understanding the meaning of the word 'defining' incorrectly here?

Indeed! Any class/interface which is not declared within another class or interface is top-level

Shane Jensen wrote:Also, why would you not be able to prefix this type of class/interface with the keyword static?

For the same reason you can't mark a top-level class/interface as private or protected It makes no sense at all!
 
Shane Jensen
Ranch Hand
Posts: 113
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel! Makes sense indeed
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!