Sitemap
Javarevisited

A humble place to learn Java and Programming better.

Member-only story

What Interviewers Expect When They Say: ‘Tell Me the Relationship Between These Classes..🎯

--

So, you’re sitting in an interview. You’re caffeinated, confident, and ready to crush it.

Then the interviewer casually throws this at you:

“Imagine you have a Rectangle, a Color, a Shape, and something called Drawable. Tell me how they’re related. Use interfaces, abstract classes, inheritance. Oh, and mention ‘is-a’ and ‘has-a’ relationships."

Your brain goes: “Wait… what does this even mean?”

Don’t worry. This is one of those classic Java OOP design questions interviewers love because it checks multiple boxes — inheritance, abstraction, interfaces, and your ability to model relationships like a real-world system.

Let’s break this down — not just to answer this one question, but to build a mindset to handle any such object-oriented design question thrown at you.

🌟 Access Alert! 🌟
If you’re a member, just scroll and enjoy! Non-members, click here for full access.

💡 First Principles: Understand the Entities

Before jumping into code or terminology, understand what each entity represents:

  • 🔷 Shape — An abstract idea; base for all…
Javarevisited
Javarevisited

Published in Javarevisited

A humble place to learn Java and Programming better.

Shubham Vartak
Shubham Vartak

Written by Shubham Vartak

Software Engineer on a Journey of Tech and Self-Discovery 😊 | 🔍 Exploring Ones and Zeroes | Merging the Art of Coding with the Wonders of Life ✨

No responses yet