java静态方法和静态变量
可能的重复:
主类java中的静态和非静态构造函数
我只是想知道人们是否同意我关于静态变量和方法的知识,因为我仍在学习java的早期概念。
静态变量意味着类的两个对象或实例共享相同的变量。静态方法只是指引用它所编写的类的方法。
如果我错了,任何人都可以纠正我,或者欢迎添加更多信息,因为我希望能够充分学习 java 并用它做一些令人惊奇的事情java的未来! :)
编码愉快!
Possible Duplicate:
static in the main class java and non static in constructor
i just want to know if people can agree with me on the knowledge I have about static variable and methods as I'm still learning java in its early concepts.
static variables means when both objects or instances of the class gets shared the same variables. static methods simply means methods that refer to the class that it is written in.
Anyone can correct me if I'm wrong or can add any more information are welcome as I want to be able to learn java to its fullest and do amazing things with java in the future! :)
Happy coding!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想阅读 - 类变量(静态字段) 和类方法。
You might want to read - Class Variables (Static Fields) and Class Methods.
静态变量
为类的所有实例共享。静态方法
通过类名直接访问,不属于任何实例。Static variables
are shared for all instances of the class.Static methods
are accessed directly by class name, not belong to any instances.