File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes protected access Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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: 1865
hi Rishi,
Here is the example,

output is,
B
A
A.protected static:A
You get it?
Regards
Maulin


1. Have fun @ http://faq.javaranch.com/java/JavaRaq
2. Looking for simple infix2postfix conversion and postfix evaluation package? Click here
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?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: protected access
 
Similar Threads
Question in K&B Book - protected class
Question about Object class
Roundup Game Question #118
How the protected finalize method is called by garbage collector
Confused with protected access