SCJP題庫第054題
1. package test;
2.
3. class Target{
4. public String name = "hello";
5. }
What can directly access and change the value of the variable name?
Ans: C
A. any class
B. only the Target class
C. any class in the test package
D. any class that extends Target
Ans: C
解說:
Target類別為預設存取屬性(package),要存取name必先存取Target類別,要存取Target類別的類別必須為同屬test套件下的類別。
Comments