why i can not access private variable in other class?

Answers were Sorted based on User's Feedback



why i can not access private variable in other class?..

Answer / naresh

private variable are visible within it class only. the are
not visible to other class within that package or other. so
we cannot access.

Is This Answer Correct ?    7 Yes 0 No

why i can not access private variable in other class?..

Answer / srinu

private variable are visible in the with in class only.This
are not accessble to other class with in same package or
other diiferent package .so we can't access the private
variable out side of classes

Is This Answer Correct ?    4 Yes 0 No

why i can not access private variable in other class?..

Answer / 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

why i can not access private variable in other class?..

Answer / maggie

it cant access.because its life time only within the class
or loop.it expires when it comes out from the class or loop.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More Java Related AllOther Interview Questions

Why do we need framework in java?

0 Answers  


Are there tuples in java?

0 Answers  


How do I enable java in firefox?

0 Answers  


What is the meaning of the words public, static and void?

0 Answers  


What is stateful in java?

0 Answers  


What do you understand by a variable?

0 Answers  


write a code in jsp to swap two numbers?

7 Answers   Wipro,


What are orm tools in java?

0 Answers  


Do I really have to type in the programs in the book to try them out?

0 Answers  


Which framework is best for rest api java?

0 Answers  


What about products that claim to block java applets at a firewall? : java security

0 Answers  


What is reflection in java?

0 Answers  


Categories