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 is blank final variable?
When can an object reference be cast to an interface reference in java programming?
How do you define a singleton class?
What is the statements?
Explain creating threads by extending thread class ?
What is quick sort in java?
What are java methods?
What are the 2 types of java programs?
How a class can implement an interface?
Are global variables initialized to zero?
What are the differences between graph and tree?
Which is fastest collection in java?