How does access modifiers work?
Public: It is the highest visibility access modifier. It makes visible the class members (variables/methods) to any classes (child/non-child) present within same or any package.
Protected: It has lesser visibility than public access modifier. It makes visible the class members (variables/methods) to sub-classes within same or different package and it also make visible in any class of same package.
Default: It has lesser visibility than protected access modifier. It makes visible the class members (variables/methods) to any classes within same package only.
Private: It has least visibility than all access modifiers. It makes visible the class members (variables/methods) within same class only.
Is This Answer Correct ? | 4 Yes | 0 No |
What are some examples of variable costs?
How does serialization work
What are the types of inner classes (non-static nested class) used in java?
Hi Friends, can you give difference between extending thread class and implementing runnable interface.
What is jvm? Why is java called the platform independent programming language?
What is string pool in java?
How to sort double array in java?
Can we overload run() method in java?
Can you give few examples of final classes defined in java api?
What about method local inner classes or local inner classes in java?
can we write a program with out a class in core java?
What is meant by final class?