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

What are new features introduced with java 8 ?

995


How to perform bubble sort in java?

997


What is the program development process?

979


Difference between final and effectively final ? Why is effectively final even required ?

994


State the difference between creating string as new () and literal.

1119


When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

1041


How to declare an arraylist in java?

1121


What is functional interface in javatpoint?

1053


Is ++ operator is thread safe in java?

965


What is the public field modifier?

1028


What is an infinite loop in java? Explain with an example.

1049


How can you traverse a linked list in java?

1129


What is the difference between yielding and sleeping in java programming?

1162


What is scope & storage allocation of global and extern variables? Explain with an example

1044


What are methods of a class?

1036