Package Access Modifier

What do you mean by package access modifier?

Questions by it.hce

Showing Answers 1 - 7 of 7 Answers

Access Modifier defines how a class can access the properties of a particular package and a class.

There are Four Access Modifiers in java
Public,
Private,
Protected,
Default Modifier (also called Friendly modifier or no modifier).

There are two types of access modifiers
1. Class Modifiers
2. Member Modifiers

1. Class Modifiers are Public and Default
2. Member Modifiers are Public,Private,Protected,Default

The Class which has a Public Modifier can be accessed by  all the classes from the particular package and also from different packages.

The Class which has the default modifier can be accessed by all the classes of that particular package.

The class which has private as the modifier cannot be accessed by any class even with in the package.

And the class which has protected as the modifier can be accessed by all the classes in a particular package and the subclasses  of other packages

shatish15

  • Sep 3rd, 2010
 

I don't understand how you can say about the private and protected access modifiers for a class. When I created a program with private and protected access modifiers, the error was that these modifiers are not allowed here.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions