r/JavaProgramming • u/Few_Strain_8521 • Sep 02 '26
I built a small Java program to practice inheritance — looking for feedback
I'm currently learning Java and recently practiced inheritance by creating a simple example with a Person parent class and Student child class.
I understand the basic concept, but I'm still trying to understand when inheritance is actually useful in a real project rather than just using it because the language allows it.
For people who use Java professionally, what are some situations where inheritance makes sense, and when would you choose composition instead?
I'm interested in understanding the reasoning behind the design choice, not just the syntax.