• + 0 comments
    1. create parent class Arithmetic and child class Adder --> don't specify there modifiers
    2. create constuctor in both classes --> used to create objects
    3. create adder method in Arithmetic or Adder class --> adding two numbers
    4. whats happeing in solution class:
      • object--> a is being created using Adder class --> Adder a = new Adder(); --> further exaplaition: Adder constructor is to create object a which inherhits constructor from parents class Arithmetic using super()
      • some methods are being called on to check its parents class (Arithmetic)
      • method add is being called on a to perform
    class Arithmetic{
        public int add(int a, int b){
            return a + b;
        }
        Arithmetic(){}
    }
    class Adder extends Arithmetic{
        Adder(){
            super();
        }
    }