Is it possible to create an anonymous class while using reflection?

前端 未结 3 571
野性不改
野性不改 2020-12-20 17:25

I would like to be able to implement a method at runtime that is called before an object runs the initializers. This will allow me to set fields that are used during initia

3条回答
  •  一整个雨季
    2020-12-20 17:58

    Do you mean something like this assuming it would compile (which it doesn't):

    @Override
    A a = aClass.newInstance()
    {
      public void initialize() {
            this.message = args[1];
          }
    };
    

提交回复
热议问题