• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

思考:为什么局部变量需要显示赋值 而成员变量不需要?


Recommended Posts

成员变量赋值和取值的顺序是不确定的,可以在方法调用之前赋值,也可以在方法调用之后赋值,具体的顺序发生在运行时,编译器无法确定。

对于局部变量,赋值和值选择的顺序是确定的。因此,局部变量的赋值是一种设计约束,可以减少出错的可能性。同时,局部变量存储在堆栈框架的局部变量表中,可控的赋值和销毁有利于局部变量表的空间重用。

Link to comment
Share on other sites