P

PrepStack

The Four Pillars and Inheritance

This section names the four pillars of OOP (object-oriented programming) and goes deep on inheritance, where a class (a plan for objects) takes over the fields and methods (its data and its actions) of another class. Encapsulation keeps data private, abstraction shows what a thing does and hides how, and polymorphism lets one call act differently depending on the object. Questions cover extends (names the parent class), super (reaches the parent), overriding (a new version of an inherited method), final (blocks change), and why Java allows only one parent class.

After this section you can name the pillars, explain inheritance in a minute, and predict small programs.

Topics in this section