private access level
java中,除了类内部,什么情况下可以访问private变量?
1 | package com.stone.javacore; |
原因JLS chapter on accessibility
Otherwise, if the member or constructor is declared private, then access is permitted if and only if it occurs within the body of the top level class (§7.6) that encloses the declaration of the member or constructor.
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 石头记!