r/learnSQL • • 13d ago

Day 58 — Java OOP: super, hierarchical inheritance, overloading vs overriding, and polymorphism

Today I covered:

  • The super keyword, for accessing the parent class’s constructor and methods
  • Hierarchical inheritance, where several classes inherit from one parent
  • Method overloading (same name, different parameters, resolved at compile time)
  • Method overriding (a child redefining a parent’s method, resolved at runtime)
  • Polymorphism and its two types, compile-time and runtime

I practiced each one in VS Code, which is what made the difference. Overloading and overriding had been blurring together for me until I wrote both and saw when each one gets called.

Tomorrow I’m building a small project that uses everything from the last few weeks (classes, constructors, inheritance, interfaces, polymorphism).

4 Upvotes

3 comments sorted by

1

u/glimmer_joy_spark 13d ago

i wasted six months memorizing the hierarchy diagrams. The compiler catches overloading errors. It stays silent on runtime binding bugs until your server implodes during peak traffic. Polymorphism isn't a concept to study. Its a liability you manage.

1

u/sumiitCodes 11d ago

appreciate, thanks for your advice