Java is not an OOP language. It is a language you can use to develop with OOP paradigm… or not. You can write “FORTRAN-like” software with Java.
The problem is, IMHO, that inheritance is perhaps the most misused concept that has done a terrible damage to object-oriented programming; every time you use extends
a kitten dies.
I learned OOP with inheritance examples in Java: Cat is an Animal so Cat extends Animal class. What a terrible idea. What a terrible example… it took me some years to go to the Light Side of the Force:
The OOP is mainly encapsulation and passing of messages, where dependencies must be seen as a client (the one sending the message) and their servers (the object that receives the message) (*)
So a trivial example as:
Mail mail = new Mail();
mail.send(content);
should not be read as “call the send method of the mail object” - so it must be as “sending a message”; and mail is a “service” for me.
(*) And if you see dependencies as client/server relations, then the IoC principle is immediate and clear. The client should not create a server but some external “service” is responsible giving your dependencies (your services).
“The most disastrous thing that you can ever learn is your first programming language” – Alan Kay