Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

What is java lang noclassdeffounderror?

0 Answers  


What is flatmap java?

0 Answers  


What is the locale class?

0 Answers  


Are streams faster than for loops?

0 Answers  


What if the main method is declared as private?

0 Answers  


What is meant by java se?

0 Answers  


Can I have multiple main methods in the same class?

0 Answers  


What is a context in java?

0 Answers  


Why doesn’t the main method throw an error with no arguments?

0 Answers  


What is contextpath in java?

0 Answers  


What are the benefits of a jar file?

0 Answers  


When do we go for java 8 stream api? Why do we need to use java 8 stream api in our projects?

0 Answers  


Categories