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...

Given:
1. package test;
2.
3. class Target {
4. public String name = “hello”;
5. }
What can directly access and change the value of the
variable name?
1 any class
2 only the Target class
3 any class in the test package
4 any class that extends Target

Answer Posted / r.jainrocks@gmail.com

a class which in same package
can access its variable name
no any class can access variable

1. class has default visibility so accessible in same package,
2. variable has public accessibility, can be access any class
which allowed in first condition.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the advantages of packages in java?

912


What does n mean?

993


What is the importance of hashcode() and equals() methods?

1050


What are recursive functions? Give some examples?

1191


Is string is a keyword in java?

973


What is method in java ?

1073


What is meant by main method?

1062


What is the preferred size of a component in java programming?

995


What are reference variables in java?

1120


What is the base class in java from which all classes are derived?

975


How do you check if a string is lexicographically in java?

952


What is final keyword in java?

1019


What are constructors in java?

1103


What an i/o filter?

1013


Explain with example the concept of constant variable in java.

1171