Java——static关键字的特点

1、static是一个修饰符,用于修饰成员。
2、static修饰的成员被所有对象所共享。
3、static优先于对象的存在而存在,因为static的成员随着类的加载就已经存在。
4、static修饰的成员多了一种调用方式,key直接被类名所调用。
5、static修饰的数据是共享数据,而对象中存储的是特有数据。

猜你喜欢

转载自blog.csdn.net/weixin_41113108/article/details/80113165