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 string pool garbage collected?
Can a top level class be private or protected?
What is one third plus one third as a fraction?
Can substring create new object?
Explain about anonymous inner classes ?
What is anti pattern in cyber security?
What is ternary operator?
What access modifiers can be used for methods?
What is the difference between interpreter and compiling ?
What is java lang object?
How listener identify that the event came from a particular object?
What is the use of a conditional inclusion statement in Java ?