Important Questions
Important Questions
Write a Java
program to implement
Single-level inheritance.
2. Explain how an interface is used to achieve multiple
Inheritances in Java
3. List out the differences between Class and Interface.
Illustrate the usage of interface in java with suitable
example
4. Interpret the general form of a class with example.
5. Write a Java program to implement multilevel
inheritance with 3 levels of
hierarchy.
6. Illustrate with example a super class variable can
reference a subclass object
7. Define dynamic method dispatch and write a code
snippet in Java to demonstrate.
8. For any class and any method as an example,
explain method overriding.
9. What is abstract class and abstract method? Explain
with an example.
10. Write your inferences on the below keywords :
A) Static
B) Final
11. Illustrate the usage of super keyword in Java with
suitable example. Also
explain the dynamic method dispatch.
12. What will be the output of the below code :
class Base {
Base()
{
// Print statement
System.out.println(
"Base Class Constructor Called ");
}
}
class Derived extends Base {
Derived()
{
System.out.println(
"Derived Class Constructor Called ");
}
}
class CallingCons {
class Parent {
void show() { System.out.println("Parent's show()"); }
}
class Overriding {
public static void main(String[] args)
{
Parent obj1 = new Parent();
obj1.show();