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 |
Is static a singleton?
Which sorting algorithm is in place?
Explain cookies?
What is the difference between panel and frame ?
7 Answers HCL, IBM, Raim Techno Solutions,
Why java is used everywhere?
What is the return type of read()?
What is class array in java?
Which class is the superclass for all the classes?
What do you understand by classes in java?
Describe inheritance as applied to java?
what really hapens when a object is created using new operator? 1.is it allocates memory to all variables and methods in the class with reference to that object?
What are the advantages of java inner classes?