In a class i can have as many constructors as I want with different argument types. I made all the constructors as private,it didn't give any error because my implicit default constructor was public But when i declared my implicit default constructor as private then its showing an error while extending the class. WHY?
this works fine
public class Demo4  {
    private String name;
    private int age;
    private double sal;
    private Demo4(String name, int age) {
        this.name=name;
        this.age=age;   
    }
    Demo4(String name) {
        this.name=name;
    }
    Demo4() {
        this("unknown", 20);
        this.sal=2000;
    }
    void show(){
        System.out.println("name"+name);
        System.out.println("age: "+age);
    }
}
This can not be inherited
public class Demo4  {
    private String name;
    private int age;
    private double sal;
    private Demo4(String name, int age) {
        this.name=name;
        this.age=age;
    }
    Demo4(String name) {
        this.name=name;
    }
    private Demo4() {
        this("unknown", 20);
        this.sal=2000;
    }
    void show() {
        System.out.println("name"+name);
        System.out.println("age: "+age);
    }
}
 
     
     
     
    