作者nf7series (真呆)
看板java
标题[J2SE] scjp考题
时间Sat Nov 17 14:14:41 2007
刚在作题库,有一题:
Given :
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
结果答案是C
我以为是A,请问答案是对的吗?谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.73.98.93
1F:推 godfat:target 不是 public class, 这是原因 11/17 14:40
2F:推 GREATSPY:同上原因 不过我觉得答案应该是B= = 11/18 10:19
3F:推 godfat:可是 Target class 不存在 XD 11/18 13:53
4F:推 nf7series:B应该是target class才对 11/18 17:48
5F:→ nf7series:谢拉 这样我就懂了 11/18 17:48