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 / manikandan [ gtec,vellore ]
Public is Visible to everywhere.
Private is visible to only the same class.
Protected is visible in same package and also sub classes in
any package.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is difference between static class and normal class?
What is the static variable?
How do I enable java in safari?
What is the meaning of variables in research?
what state does a thread enter when it terminates its processing? : Java thread
Is minecraft java edition free?
What are accessor methods in java?
Can we have return statement in finally clause? What will happen?
What is procedure writing?
Can java object be locked down for exclusive use by a given thread?
What is java util hashmap?
Where to store local variables?
What are the advantages of java?
Explain the concept of hashtables?
What are the different approaches to implement a function to generate a random number?