您当前的位置: 首页 >  段智华 jvm

jvm 第6章 类和对象

段智华 发布时间:2016-12-27 19:53:34 ,浏览量:4

jvm 第6章 类和对象

package jvmgo.book.ch06;


public class MyObject {


    public static int staticVar;
    public int instanceVar;


    public static void main(String[] args) {
        int x = 32768; // ldc
        MyObject myObj = new MyObject(); // new
        MyObject.staticVar = x; // putstatic
        x = MyObject.staticVar; // getstatic
        myObj.instanceVar = x; // putfield
        x = myObj.instanceVar; // getfield
        Object obj = myObj;
        if (obj instanceof MyObject) { // instanceof
            myObj = (MyObject) obj; // checkcast
            System.out.println(myObj.instanceVar);
        }
    }


}




关注
打赏
查看更多评论

段智华

暂无认证

  • 4浏览

    0关注

    1232博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录