Inheritance is one of the core principles of object-oriented programming (OOP), which help us derive a class from another class or a hierarchy of classes that share a set of attributes and methods. In other words, it is a relationship between a superclass (a more generalised class) and a subclass (a more specialised class), where the subclass inherits data and behavior from the superclass.
The Dependency Inversion Principle (DIP) states that high-level modules should not depend on low-level modules; both should depend on abstractions. This abstraction removes the direct dependency on the details, decoupling it and thus allows for easier re-use of the important functionality in the policy.
Java language has a feature called method overloading, which allows multiple methods within a class to have the same name with different argument lists. It is a type of polymorphism (the process by which we can perform a single task in various ways). To be more concise, overloading is an example of static polymorphism.
The Interface Segregation Principle states that a client should never be forced to depend on methods it does not use. We achieve this by making our interfaces small and focused**. It would be best to split large interfaces into more specific ones focused on a particular set of functionalities so that the clients can choose to depend only on the functionalities they need.
In oops, we may want our object to get initialized with some specific properties, or we may need to do some operations every time an object is instantiated. To do such things, we use constructors. In simple words, a constructor is defined inside the class that contains the code to instantiate the class object.
A class is a user-defined blueprint that describes what a specific kind of object will look like, but an object is an instance of a class, which contains data and methods working on that data. In simple words, classes and objects are the fundamental building blocks of Object-Oriented Programming (OOPS).