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 are different type of access modifiers?
How to display all the prime numbers between 1 and 100
What is the purpose of the system class in java?
suppose we have an interface & that interface contains five methods. if a class implements that interface then we have to bound that to give tha definition of all five methods in that class. If we declare that class as abstract then can we call only two methods to give the deinition of that method & i don't want to give the definition of all the methods? can it possible
Can we restart a thread already started in java?
Which variables are stored in stack?
What is the difference between Integer and int?
What is difference between add() and addelement() in vector?
Explain public static void main(string args[]).
Program to Find the second largest element in an array.
What is integer valueof?
What is classname class in java?