why i can not access private variable in other class?
Answer Posted / srihari
private variables are visible within the class they are
defined but not in the other classes present in same package
& classes in different packages. Hence, we call "private"
variables as "CLASS-LEVEL" instances.
private variables are used when we do not want the variable
declared in a class to be shared or used by other classes
present in same packages or different packages.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Do I need jdk or jre?
What is repository pattern in java?
What is contextpath in java?
What is meant by annotations in java?
What is default constructor in java?
Do I need to install jre if I have jdk?
What is resultsetmetadata in java?
What is gui in java with examples?
Is jvm a compiler or an interpreter?
What if the main method is declared as private?
In system.out.println(), what is system, out and println?
What is entitymanager in jpa?
What is the first argument of the string array in main method?
Explain the encapsulation principle.
Explain working of java virtual machine (jvm)?