zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    Niginx 集群负载均衡策略
    饿了吗开源组件库Element模拟购物车系统
    HTML5随记
    Javascript基础
    Javascript封装弹出框控件
    sublime插件(配合nodejs环境)
    使用Java注解开发自动生成SQL
    Java实现多线程下载
    开发工具随记
    开发工具的安装及环境搭建
  • 原文地址:https://www.cnblogs.com/xhwy-1234/p/12485924.html
Copyright © 2011-2022 走看看