• Post Reply Bookmark Topic Watch Topic
  • New Topic

protected access modifier  RSS feed

 
rizwana mujawar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't try to use tabs for indenting. Use spaces.


Why rules are different for protected methods and protected variables in java.


They're not. In both cases, a child class from a different package can access the member only as this.whatever or super.whatever, Not as some_other_object_of_this_class.whatever. You must have been doing it one way for methods and the other way for variables.


 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And in the future:

1) Please keep your code lines shorter so we don't have to sroll right to read them.

2) Please do not put your questions inline with your code.
 
Zeeshan Sheikh
Ranch Hand
Posts: 144
Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check this Oracle Tutorial. THanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!