金昊's profile徘徊PhotosBlogLists Tools Help

Blog


    February 19

    关于“static”的整理

        static表示“静态”;
     1.static变量:  
        1)static变量的加载时间:在包含该变量的类第一次被加载的时候,JVM为该变量分配内存地址。
        2)static变量的唯一性:被static修饰的成员变量独立于该类的任何实例,它不像实例变量对应一个实例,而是被所有类共享。
        3)static变量声明:不会生成static变量的副本。
     2.static方法:
        1)静态方法若声明为public可以直接调用,但是在静态方法中只能调用static变量;
        2)静态方法一样是被所有实例公用的,所以在静态方法中不能用this关键字。但是如果实例方法调用静态变量可以用this关键字。
    3.static块:
         没什么了,按顺序执行。。。。。。每个代码块只会被执行一次。
     

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    zhiyuanwrote:
    鸭什么时候变技术流了
    Feb. 20

    Trackbacks

    The trackback URL for this entry is:
    http://ljh32211422.spaces.live.com/blog/cns!4105CE74F6EB693E!1037.trak
    Weblogs that reference this entry
    • None