In the following Java code, what can directly access and change the value of the variable name?
package test;
class Target
{
public String name = "hello";
}
package test;
class Target
{
public String name = "hello";
}A. any class
B. only the Target class
C. any class in the test package
D. any class that extends Target
Answer: Option C

Join The Discussion