21.
What is the purpose of the "final" keyword in Java?

22.
In Java, can an abstract class have constructors?

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

abstract class MyAbstract {
MyAbstract() {
System.out.println("Constructor");
}
}
class MyClass extends MyAbstract {
public static void main(String[] args) {
MyClass obj = new MyClass();
}
}

24.
In Java, can an interface have static methods with implementations?

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

interface MyInterface {
static void myMethod() {
System.out.println("Static Method");
}
}
class MyClass implements MyInterface {
public static void main(String[] args) {
MyInterface.myMethod();
}
}

26.
In Java, can an abstract class have private methods with implementations?

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

abstract class MyAbstract {
private void myMethod() {
System.out.println("Private Method");
}
}
class MyClass extends MyAbstract {
public static void main(String[] args) {
MyClass obj = new MyClass();
obj.myMethod();
}
}

28.
In Java, can an abstract class have static methods with implementations?

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

abstract class MyAbstract {
static void myMethod() {
System.out.println("Static Method");
}
}
class MyClass extends MyAbstract {
public static void main(String[] args) {
MyAbstract.myMethod();
}
}

30.
In Java, can an abstract class have default methods with implementations?

Read More Section(Interfaces and Abstract Classes)

Each Section contains maximum 100 MCQs question on Interfaces and Abstract Classes. To get more questions visit other sections.