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 |
How do you start a thread?
Can we override the main method?
What is static method with example?
What is vector?
What Method and class used for Connection pooling ?
Is delete, next, main, exit or null keyword in java?
Why stringbuilder is not thread safe in java?
how many ways we can serialize the java object?
whst is encapsulation?when u encpsulate actually while devoloping code?
How are destructors defined in java?
What is a top level class in java?
what is the difference between process and thread? : Java thread