[J2SE] 變數 scope 問題
剛在作題庫,有一題:
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
推
11/17 14:40, , 1F
11/17 14:40, 1F
推
11/18 10:19, , 2F
11/18 10:19, 2F
推
11/18 13:53, , 3F
11/18 13:53, 3F
推
11/18 17:48, , 4F
11/18 17:48, 4F
→
11/18 17:48, , 5F
11/18 17:48, 5F