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
What is getkey () in java?
What are the wrapped, classes?
How is it possible for two string objects with identical values not to be equal under the == operator?
What is the purpose of the runtime class in java programming?
What is set in java?
What is basic syntax?
What is the default value of the local variables?
Lowest Common ancestor in a Binary Search Tree and Binary Tree.
What is the difference between the paint() and repaint() methods?
Is main a function?
Explain about the interpreter in java?
define the terminology association.
What is the transient keyword?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
Is set thread safe java?