看板 java 關於我們 聯絡資訊
剛在作題庫,有一題: 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