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 a conditional statement explain with example?
What are the main differences between notify and notifyAll in Java?
What do you mean by Function Overloading in java?
What is the argument type of main() method?
What is difference between c++ and java ?
What is parsing a string?
What is the file extension for java?
What code optimizations techniques you follow in general practice?
2 Answers Accenture, TCS, Wipro,
How to perform selection sort in java?
What is hashmap in java?
Explain java coding standards for constants?
What are the advantages of java inner classes?