Call a method after the constructor has ended

前端 未结 7 782
迷失自我
迷失自我 2020-12-31 07:19

I need to call a method after the constructor has ended and I have no idea how to do. I have this class:

Class A {
    public A() {
        //...
    }

             


        
相关标签:
7条回答
  • 2020-12-31 08:09

    Why not this :

    Class A {
        public A() {
            //... Do you thing
            this.init();
        }
    
        public void init() {
            //Call after the constructor
        }
    }
    
    0 讨论(0)
提交回复
热议问题