الرجوع
تسجيل الدخول

What will printed if we remove default constructor from Animal class

public class Animal {
    private String name;

    public Animal() {
        name = "Lion";
    }

    public String getName() {
        return name;
    }

    public static void main(String[] args) {
        Animal lion = new Animal();
        System.out.println(lion.getName());
    }
}