File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Access Modifiers 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 "Access Modifiers" Watch "Access Modifiers" New topic

Access Modifiers

Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127
Hi All,
Java has a �default� access, which comes into play if you don�t use one of the "accessmodifiers" but outside of the package those same members appear to be private

Is the aforementioned true?If so please describe with a program

Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1850

i hope this link will clear your doubts.

different.Access Specifiers

Krishna Srinivasan
OCAJP 7/8 Exam, 400+ OCPJP Mock Questions
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
you declare that a class member has default accessibility (because you did not specify public,protected, or private)

This kind of accessibility is called package accessibilty. That's to say: only classes in same package can acces this class members. Classes in other packages can't, no matter that they inherit from this class which declared that public accessibility member. Now try this to see what happens? Declare an abstract class which has an abstract method with default accessibility. Now make anothe class in other package inherit from this one. What will happen, since the abstract method is not accessible for the inherite
I agree. Here's the link:
subject: Access Modifiers
It's not a secret anymore!