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
What is stateful in java?
Why is javac not recognized?
What is an api in java?
What are the advantages of lambda functions?
Can java program run without jdk?
What are the benefits of a jar file?
What is rxjava2?
What does el mean in java?
Which is better openjdk or oracle jdk?
What are the advantages of java sockets?
Are the actual permissions for the application defined at run-time or compile-time? : java security
What is a singleton in java?
If you’re overriding the method equals() of an object, which other method you might also consider?
What do you understand by downcasting?
What is flatmap java?