Parent obj = new Child(); What’s the Output? 🤔 | Java OOPS Trick Question
Автор: Mind2Machine
Загружено: 2025-10-26
Просмотров: 251
Описание:
Here’s a tricky Java interview question that tests your understanding of method overriding and runtime polymorphism 👇
class Parent {
void show() { System.out.println("Parent"); }
}
class Child extends Parent {
void show() { System.out.println("Child"); }
}
public class Main {
public static void main(String[] args) {
Parent obj = new Child();
obj.show();
}
}
What will be the output of this Java code?
Options:
A) Parent
B) Child
C) Compilation Error
🧠 Watch till the end for the answer!
This concept is one of the most common Java interview questions related to OOPS and polymorphism.
#Java #JavaQuiz #JavaShorts #OOPS #Polymorphism #JavaInterviewQuestions #JavaProgramming #LearnJava #JavaConcepts #CodeWithSandeep #JavaTrickyQuestion #CodingQuiz #ProgrammingShorts
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: