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基础知识18.4成员变量如果没有被赋初值,则会自动以类型的默认值而赋值(一种情况例外被 final 修饰但没有被 static 修饰的成员变量必须显示地赋值);而局部变量则不会自动赋值。 #72

Closed
Gene1994 opened this issue Dec 6, 2018 · 1 comment

Comments

@Gene1994
Copy link
Contributor

Gene1994 commented Dec 6, 2018

Java基础知识18.4
原文:成员变量如果没有被赋初值,则会自动以类型的默认值而赋值(一种情况例外被 final 修饰但没有被 static 修饰的成员变量必须显示地赋值);而局部变量则不会自动赋值。
我试了一下 同时被final 和 static修饰的变量也需要被显示地赋值?这里是作者笔误吗?还是我理解的不对?

@Snailclimb
Copy link
Owner

已更正!

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

No branches or pull requests

2 participants