What access modifiers can be used for class ?



What access modifiers can be used for class ?..

Answer / Pankaj Tripathi

In Java, the following four access modifiers can be used for classes: 1. public (can be accessed anywhere), 2. protected (can be accessed within the same package and subclasses of other packages), 3. default or no access modifier (can be accessed only within the same package), 4. private (can only be accessed within the same class).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Is linked list a linear or non-linear data structure?

1 Answers   Akamai Technologies,


Can we write a class without main method in java?

1 Answers  


I have a Person object with 5 variables and I want to store them in a file called Person.txt. What should I do?

3 Answers   KPIT,


What is hasnext in java?

1 Answers  


What is byte value?

1 Answers  


As a developer what steps do you take to improve the performance?

4 Answers  


Using callable statement how can you pass out parameters, explain with example?

1 Answers  


Is char * a string?

1 Answers  


After compilation of java program we'll get .class code. If it's generated in OS Windows XP will it work on OS Linux? If yes why? If no why?

5 Answers   Aricent,


What is synchronization and why is it important in java programming?

1 Answers  


what are the uses of Class class and what it returns? explain it with the example code.

1 Answers  


What is * argv?

1 Answers  


Categories