Any way to extend two or more classes in java?

前端 未结 12 1461
再見小時候
再見小時候 2021-01-17 02:20

I know that Java does not allow us to extend more than one class. I know that interfaces also exist and I don\'t want to use them this time. Is there some kind of trick or w

12条回答
  •  囚心锁ツ
    2021-01-17 02:49

    may be this helps

        class One{
        void oneMethod(){
    
        }
    }
    
    class Two extends One{
        void TwoMethod(){
    
        }
    }
    
    class Abc extends Two{
    
        @Override
        void oneMethod() {
            // TODO Auto-generated method stub
            super.oneMethod();
        }
    
        @Override
        void TwoMethod() {
            // TODO Auto-generated method stub
            super.TwoMethod();
        }
    
    
    }
    

提交回复
热议问题