Skip to content

Instantly share code, notes, and snippets.

@Mahdi-Hasan
Last active August 22, 2021 17:01
Show Gist options
  • Select an option

  • Save Mahdi-Hasan/0374280653144e87422b25f1aa7a6834 to your computer and use it in GitHub Desktop.

Select an option

Save Mahdi-Hasan/0374280653144e87422b25f1aa7a6834 to your computer and use it in GitHub Desktop.
This is a question of Multilevel Inheritance....What will be the output & Explain your answer.
public A{
public void print(){
System.out.println("Inside A");
}
}
class B extends A{
public void print(){
System.out.println("Inside B");
}
}
class C extends B{
}
class Test{
public static void main(String[] args) {
C c = new C();
c.print();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment