公共和静态之间的区别? [英] difference between public and public static?

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

问题描述

静态意味着什么?



我知道公共意味着它可以从课程外部访问,并且只能在课程内部访问。

解决方案

静态意味着可以在不实例化类的情况下访问它。这对常量很有用。

静态方法需要对对象的状态没有影响。除参数外,它们还可以有局部变量。


what does static mean?

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天全站免登陆