package main.java.jvm;

/**
 * This class is intended to demo how main.java.jvm create object and invoke constructor. Please see byte code.
 * use javap -v ObjectCreate.class  or javap -c  ObjectCreate.class to see byte code
 */
public class ObjectCreate {
    private String field;

    // will invoked by invokespecial
    public ObjectCreate(String field) {
            this.field = field;
    }

    public void print() {
        show();
    }

    private void show() {
        System.out.println(field);
    }

    public static void main(String[] args) {
        ObjectCreate objectCreate = new ObjectCreate("hello!");
        objectCreate.print();
    }
}
