OO ConceptsHomepage « Learn Java5 « OO Concepts
In our third section on learning Java5 we look at the quadrumvirate of OO Concepts - encapsulation, inheritance, abstraction and polymorphism.
Up until now, for learning purposes, we have ignored many important object oriented concepts that we can use within our Java programs. This neglect is rectified in this section where we start our study of OO concepts by
looking at encapsulation and how to protect our data. We then tackle inheritance over two lessons where we look at creating hierarchies, overriding methods and the use of super. After this we look at
abstraction and how we apply it to our classes and methods. We then examine polymorphism and how to use it with our methods, arguments and return types. Our investigation of polymorphism continues as we investigate interfaces
and their usage. We then return to the idea of encapsulation as we look into nested classes, what they are and how to use them. We finish the section with a detailed look at the Object class and the methods
we inherit and can override in our subclasses.
Encapsulation
Up until now we haven't really worried about our data and how we expose it to the outside world. That is all about to change as we look at encapsulation.
Inheritance Basics
This lesson introduces us to the OO concept of Inheritance and what it means. We also learn how we create inheritance hierarchies before tackling method overrides.
Inheritance Concepts
We continue our investigation of inheritance and conceptualize where our objects fit into the hierarchy and also investigate superclass members, overrides and constructors.
Abstraction
In this lesson we continue our investigation of OO concepts by looking at abstraction and how we use it with our classes and methods.
Polymorphism
In this lesson we continue our investigation of OO concepts by learning about polymorphism, which roughly translated from the Greek means 'the ability to assume different forms'.
Interfaces
This lesson looks at interfaces and the contracts we provide when using them. We also delve deeper into polymorphism where we look at polymorphic interface arguments and polymorphic return types.
Nested Classes
In this lesson we learn about the various ways to code nested classes within our classes.
The Object Superclass
We finish the section with a detailed look at the Object object, the 'daddy' of all classes. We examine the methods in the class, paying particular attention to those we might need to override in our subclasses.