java-static

1.意思是静态的
2.可以修饰:方法、成员变量、内部类、代码块
3.修饰后有什么不同
    - 修饰方法:(叫静态方法或者类方法)
        1.这个方法对于其他类来说可以用“类名.方法”进行调用,也可以使用“对象名.方法”进行调用,推荐使用“类名.方法”
        2.静态方法中是不允许出现,this,super,对本类的非静态属性,非静态的方法直接使用代码的
    - 修饰成员变量
        1.用static修饰的成员变量的值,表示是这个类型的所有对象“共享的”
        2.static修饰的成员变量的值存储在方法区
        3.static修饰的成员变量的get/set也是静态的
        4.如果在方法中有局部变量与static修饰的成员变量同名时,在静态变量前面加“类名.”进行区别
## 结论:非静态的“对象名.” ,静态的用“类名.”
When nothing seems to help, I go look at a stonecutter hammering away at his rock, perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow it will split in two, and I know it was not that blow that did it, but all that had gone before. -- Jacob Riis
原文地址:https://www.cnblogs.com/xhwy-1234/p/12485924.html