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 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
Author

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

tx
carl...
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

i hope this link will clear your doubts.

different.Access Specifiers


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 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
class?
 
Don't get me started about those stupid light bulbs.
 
subject: Access Modifiers