《Thikning in java》阅读笔记(3)-权限

myhalfsea posted @ 2011年1月03日 21:28 in JAVA , 1228 阅读

    java 中,对于某些严谨的程序,读前线的控制应该引起足够的重视,以前在写代码的时候,追求方便和速度,将几乎所有的方法都设置为public,在<Thinking in java>中,将前端程序员与类开发者分开,我到现在还不明白为什么要这样做。如果单单是写一个工具类型的软件,可以称为“类开发者”,但实际上,在中国,除了大型的软件公司,自己包装一下框架外,有多少这样的类开发者呢?

    扯远了……

    对于public、protected、private的理解:

    public不用说,全局有效的。

    private的属性与方法,只能在类定义体里面可以访问。

    protected呢? 相同包内的其他类、所有继承此类的子类可以访问protected的元素。

jnanabhumiap.in 说:
2024年1月27日 15:40

JNANABHUMI AP provides all latest educational updates and many more. The main concept or our aim behind this website has been the will to provide resources full information on each topic which can be accessed through Internet. To ensure that every readers get’s what important and worthy about the topic they search and link to hear from us. jnanabhumiap.in Jnanabhumi AP is a startup by passionate webmasters and bloggers who have passion to provide engaging content which is accurate, interesting and worthy to read. We are mope like a web community where you can find different information’s, resources, topics on day to day incidents or news. We provide you the finest of web content on each and every topics possible with help of editorial and content team.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta
Butterfly Theme | Design: HRS Hersteller of mobile Hundeschule.