0
点赞
收藏
分享

微信扫一扫

jvm 第6章 类和对象


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);
}
}


}

jvm 第6章 类和对象_System

jvm 第6章 类和对象_System_02


举报

相关推荐

0 条评论