• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

protected access modifier

 
devika cha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A protected instance variable can be accessed by subclass in same package or from different package by inheritance.

My question is how to access protected instance var in the subclass that is in same package .
thank you.
[ edited to preserve formatting using the [code] and [/code] UBB tags and to format the code -ds ]
[ January 09, 2004: Message edited by: Dirk Schreckmann ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34665
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sulakshana,
You have the right idea. In the example you posted, the dep class is not a sublcass of the Test class. It is extending a class called ThreadTest.

[ January 08, 2004: Message edited by: Jeanne Boyarsky ]
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
protect from what?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic