21.
In Java, can a subclass override a default method from its superclass?

22.
What is the purpose of the "protected" access modifier in Java inheritance?

23.
In Java, can a subclass access public members (fields and methods) of its superclass defined in another package?

24.
What is the result of the following code snippet?

class Parent {
void display() {
System.out.println("Parent");
}
}
class Child extends Parent {
public static void main(String[] args) {
Child obj = new Child();
obj.display();
}
}

25.
In Java, can a subclass override a static method from its superclass?

26.
What is the result of the following code snippet?

class Parent {
static void display() {
System.out.println("Parent");
}
}
class Child extends Parent {
public static void main(String[] args) {
Child obj = new Child();
obj.display();
}
}

27.
In Java, can a subclass inherit private fields from its superclass?

28.
What is the result of the following code snippet?

class Parent {
private int x = 10;
}
class Child extends Parent {
int x = 20;
void display() {
System.out.println(super.x + " " + x);
}
}
public class Main {
public static void main(String[] args) {
Child obj = new Child();
obj.display();
}
}

29.
In Java, can a subclass override a final method from its superclass?

30.
What is the result of the following code snippet?

class Parent {
final void display() {
System.out.println("Parent");
}
}
class Child extends Parent {
void display() {
System.out.println("Child");
}
public static void main(String[] args) {
Child obj = new Child();
obj.display();
}
}