import java.util.*;
import java.lang.*;
import java.io.*;


class Base1{
    Base1(){
        System.out.println("I am a constructor");
    }
    Base1(int x){
        System.out.println("I am an overloaded constructor with value of x as: " + x);
    }
}

class Derived1 extends Base1{
    Derived1(){
        super(0);
        System.out.println("I am a derived class constructor");
    }
    // super 0 ka mtlb h jese hi bina argument wala constructor yha aayega isko run krane 
    // wo super 0 uusee uppr wali class m bhej dega argument x lekr fir run base1(int x ) ye wali method
    Derived1(int x, int y){
      //  super(x);
        System.out.println("I am an overloaded constructor of Derived with value of y as: " + y);
    }
}


public class Main {
    public static void main(String[] args) {
        // Base1 b = new Base1();
        // Derived1 d = new Derived1();
        // Derived1 d = new Derived1(14, 9);
       
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: