21. What is the purpose of the "super" keyword in method overloading?
22. In Java, can a subclass overload a method from its superclass?
23. What is the result of the following code snippet?
class Parent {
void display() {
System.out.println("Parent");
}
}
class Child extends Parent {
void display() {
System.out.println("Child");
}
}
public class Main {
public static void main(String[] args) {
Parent obj = new Parent();
obj.display();
}
}
class Parent {
void display() {
System.out.println("Parent");
}
}
class Child extends Parent {
void display() {
System.out.println("Child");
}
}
public class Main {
public static void main(String[] args) {
Parent obj = new Parent();
obj.display();
}
}