java对象是怎么在jvm中new出来的
查看java对象字段属性在内存中的值
java 对象 创建 流程
附上java源码
public class MiDept {private int innerFiled=999;public MiDept() {System.out.println("new MiDept--------------");}public String show(int data) {System.out.println("mi--------------"+data);return "yym-invoke-method";}public int getInnerFiled() {return innerFiled;}public void setInnerFiled(int innerFiled) {this.innerFiled = innerFiled;}
}public class GDBDebugJava {public static int static_field = 8888;MiDept miDept0=null;MiDept miDept1=null;MiDept miDept2=null;public static void main(String[] args) {GDBDebugJava gDBDebugJava = new GDBDebugJava();int i=0;try {TimeUnit.SECONDS.sleep(1);System.out.println("mi"+i++);}catch (Exception e) {e.printStackTrace();}Thread.currentThread().setName("yym");gDBDebugJava.miDept0 = new MiDept();gDBDebugJava.miDept0.setInnerFiled(666);System.out.println(gDBDebugJava.miDept0.show(123456));}}
1、分配java对象内存 jvm源代码oop obj = klass->allocate_instance(CHECK);
2、打印java对象在内存中地址
3、查看java对象在int属性在内存中值
计算器转换10十进制数字