作者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
推 godfat:target 不是 public class, 這是原因 11/17 14:40
推 GREATSPY:同上原因 不過我覺得答案應該是B= = 11/18 10:19
推 godfat:可是 Target class 不存在 XD 11/18 13:53
推 nf7series:B應該是target class才對 11/18 17:48
→ nf7series:謝拉 這樣我就懂了 11/18 17:48