“公开"与“公开"之间的区别在于和“公共静态"? [英] The difference between "public" and "public static"?

查看:229
本文介绍了“公开"与“公开"之间的区别在于和“公共静态"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

static是什么意思?

我知道public意味着可以从类外部访问它,而private仅可以从类内部访问…

I know public means that it can be accessed from outside the class, and private only from inside the class…

推荐答案

静态表示无需实例化类即可对其进行访问.这对常量很有用.

Static means that it can be accessed without instantiating a class. This is good for constants.

静态方法无需影响对象的状态.除了参数外,它们还可以具有局部变量.

Static methods need to have no effect on the state of the object. They can have local variables in addition to the parameters.

这篇关于“公开"与“公开"之间的区别在于和“公共静态"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆