首页
随机
最近更改
特殊页面
社群首页
参数设置
关于WHY42
免责声明
WHY42
搜索
用户菜单
登录
欢迎来到Riguz的小站!这是一个私人wiki,用来记录一些我的笔记。
查看“︁Java:Access levels”︁的源代码
←
Java:Access levels
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{| class="wikitable" border="1" |- ! Modifier ! Class ! Package ! Subclass ! World |- | public | Y | Y | Y | Y |- | protected | Y | Y | Y | N |- | no modifier | Y | Y | N | N |- | private | Y | N | N | N |} =Tips on Choosing an Access Level:= If other programmers use your class, you want to ensure that errors from misuse cannot happen. Access levels can help you do this. *Use the most restrictive access level that makes sense for a particular member. Use <font color="red">private</font> unless you have a good reason not to. *<font color="red">Avoid public fields</font> except for constants. (Many of the examples in the tutorial use public fields. This may help to illustrate some points concisely, but is not recommended for production code.) Public fields tend to link you to a particular implementation and limit your flexibility in changing your code. [[Category:Programe]]
返回
Java:Access levels
。