• Post Reply Bookmark Topic Watch Topic
  • New Topic

Real Purpose of Using Protected Access Specifier  RSS feed

 
Sasikumar Senthilnathan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the real purpose of using Protected access specifier in Java?
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the Oracle tutorial about access specifiers? If not, here it is: Controlling Access to Members of a Class.

If you have read it, then could you ask a more specific question about access specifiers?
 
Michael Gomez
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes I will make private methods protected so that my JUnit Test classes (in the same package but different folder) can invoke them.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!