aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes protected access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "protected access" Watch "protected access" New topic
Author

protected access

Rishi Wright
Ranch Hand

Joined: Jun 25, 2003
Posts: 46
Hi 'all
say A & B are classes in different PACKAGES
and B extends A
Then
1)how can I call a PROTECTED OVERRIDEN method in A from B
2)How can I access the STATIC PROTECTED method of A from B
a simple example would be more helpfullllll.....
thank you
rishi
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Rishi,
Here is the example,

output is,
B
A
A.protected static:A
You get it?
Regards
Maulin
Rishi Wright
Ranch Hand

Joined: Jun 25, 2003
Posts: 46
Thnx Maulin...I wanted to confirm there is no other way to call superclass overridden method other than using super (I mean any reference variable)..
thnx agian
rishi
Selim Hendrickson
Greenhorn

Joined: Aug 14, 2003
Posts: 9
Maulin I'm confused. I thought the extending class would not be able to invoke protected methods through reference. Is super an exception to this rule?
 
wood burning stoves
 
subject: protected access