• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Access Modifiers

 
Venkat Ramsimha
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1874
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i hope this link will clear your doubts.

different.Access Specifiers
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic