Tricky Java Interview Question | Static Method Hiding in Java |

Опубликовано: 11 Июнь 2026
на канале: Mind2Machine
226
7

🚀 In this short, we’ll test your Java knowledge with a tricky OOPs question!
Two classes have the same static method — what do you think will be printed? 🤔

This concept is called Static Method Hiding in Java.
📘 Remember: Static methods are not overridden, they are hidden, and the reference type decides which method gets called.

✅ Output: A
💡 Explanation: Since display() is static, it depends on the reference type (A obj), not the object (new B()).

👉 Watch more Java interview tricks on my channel!
#Java #InterviewQuestion #OOPS #Shorts #JavaProgramming #JavaTrickyQuestion #StaticMethodHiding #JavaConcepts #CodeWithMe