オブジェクト呼び出し方法


 


public class C {
    void g() {
        B b1 = new B();
        b1.protect();
        System.out.println(b1.i);
    }
    public static void  main(String[]args)
    {
    	new C().g();
    }
}

gを び すメソッドのバイトコード

 void g()
    {
    //    0    0:new             #2   <Class B>
    //    1    3:dup             
    //    2    4:invokespecial   #3   <Method void B()>
    //    3    7:astore_1        
    //    4    8:aload_1         
    //    5    9:invokevirtual   #4   <Method void B.protect()>
    //    6   12:getstatic       #5   <Field PrintStream System.out>
    //    7   15:aload_1         
    //    8   16:getfield        #6   <Field int B.i>
    //    9   19:invokevirtual   #7   <Method void PrintStream.println(int)>
    //   10   22:return          
    }

にオブジェクトを したことがわかります
new #2
ローカル 、すなわちスタックに し みます!オブジェクトの
に、B Classインスタンスのメソッドproctectメソッドをロードします.
つまりクラスインスタンスをマウントすることは、プログラムとクラスデータ を する です!!