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
Can we use a default constructor of a class even if an explicit constructor is defined?
What is private public protected in java?
How does callback work in java?
What is the intersection and union methods?
How do you compare objects in java?
What do you mean by platform independence of Java?
How listener identify that the event came from a particular object?
What’s the difference between applets and standalone program?
What do you mean by platform independence? What is an interface?
What are the different types of constructor?
What are the actions that can occur when a thread enters blocked state?
What is the core java?
What is volatile keyword in java
What is core java used for?
What do you mean by ternary operator in java?