Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java 基础之权限修饰符初稿完工 #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

zgh0711
Copy link
Contributor

@zgh0711 zgh0711 commented Oct 24, 2017

java 基础之权限修饰符初稿完工

@zgh0711 zgh0711 requested a review from wheat7 October 24, 2017 11:25
@wheat7
Copy link

wheat7 commented Oct 30, 2017

我觉得跑题了,我觉得题目意思是解释权限访问修饰符的作用 然后解释让读者体会应用场景,是理解要理解封装,如何隐藏实现什么的,而不是解释修饰符。并且应该有帮助其他同学理解的点,阐述自己理解的思路,不然这么介绍一通,理解的还是理解,不理解的还是理解不了的


## static
字面意思:静态的。既然有静态的,那么肯定也会有相应的动态的,这里的静态和动态其实是相对于内存的变化来说的。
一个类在被实例化的时候,JVM 会给它初始化一个内存地址,如果这个类有多个实例,它们的内存地址是不一样的,这即是动态。那么静态就可以理解为它的内存地址是不会变的,被 static 修饰的变量和方法在类被初始化的时候会被分配到一个单独的内存地址中,一旦分配好就不会再变了。**这里是说的内存地址不会变,但是它里面的内容或值是可以变的,但是如果前面同时有 final 修饰的话,那么值也是不变的。**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉可以具体说明下 static 和 final 修饰的变量放在哪个内存区

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants