In this chapter we introduce Object Oriented Programming (OOP), classes and hierarchies, inheritance, interface and abstract classes using Java. We also introduce UML class diagrams and javadoc style documentation. We also study exceptions in Java.
Java uses the Object-oriented programming paradigm which allows classes and their hierarchies that can be used to write reusable code. We will not only look at Java classes but also learn how to extend an existing Java class to define a new class that inherits all the attributes of the parent class. The extended class will also have its own attributes. We will also study the concept of polymorphism that allows Java to determine which version of the method to execute at runtime.
We will study interfaces and abstract classes and also describe their relationship with each other and with actual classes. We introduce the abstract class Number. We also discuss class Object, which all classes extend, and we describe several of its methods that may be used in classes that you create.
We will study the Exception class in some depth and understand the aforementioned nuances.
We will end the chapter by studying packages in Java and the various kinds of visibility for instance variables (data fields) and methods.