Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rules for Protected and Default Members  RSS feed

 
Brian Reindel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am jotting down notes while studying for the SCJP exam, and I want to be sure that I get this concept 100%. Would it be correct to make the following two statements:

"A default member of a public class can only be accessed by a class or a subclass within the same package."

"A protected member of a class can be inherited by a subclass in a different package, but it cannot be referenced."

If this is not completely correct, or you have alternate ways of stating these two rules, please let me know.

Thanks
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

I'm moving this to our SCJP forum for special attention. (See links at top of page to continue discussion there.)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!