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?

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


Please Help Members By Posting Answers For Below Questions

Do I need jdk or jre?

857


What is repository pattern in java?

920


What is contextpath in java?

913


What is meant by annotations in java?

978


What is default constructor in java?

877


Do I need to install jre if I have jdk?

893


What is resultsetmetadata in java?

899


What is gui in java with examples?

1043


Is jvm a compiler or an interpreter?

1053


What if the main method is declared as private?

891


In system.out.println(), what is system, out and println?

1012


What is entitymanager in jpa?

886


What is the first argument of the string array in main method?

970


Explain the encapsulation principle.

925


Explain working of java virtual machine (jvm)?

1039