当前位置: 代码迷 >> J2EE >> 一个ocjp的有关问题?
  详细解决方案

一个ocjp的有关问题?

热度:60   发布时间:2016-04-19 22:34:09.0
求助一个ocjp的问题??
package test;

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

为什么是c啊,name是public的,应该任何类都可以吧?
------解决方案--------------------
public   class Target