Chapter 9. Object-Oriented Programming

In this chapter we will discover that in Java, classes are fundamental to just about everything. We will begin to understand why the software engineers at Sun Microsystems back in the early 1990's made Java the way they did.

We have already talked about reusing other people's code, specifically the Android API, but in this chapter, we will really get to grips with how this works and learn about object-oriented programming (OOP) and how to use it.

In short, we will cover the following topics:

  • What OOP is including encapsulation, inheritance, and polymorphism
  • Writing and using our first, very own class
  • Encapsulation in depth and how it helps us
  • Inheritance in depth and how to take full advantage of it
  • Polymorphism explained in greater detail
  • Static classes and how we have been using them already
  • Abstract classes and interfaces

Important memory management warning

Before we get into exactly what OOP is, a quick warning.

I'm referring to our memories for a change. If you try to memorize this chapter, you will have to make a lot of room in your brain and you will probably forget something really important in its place, like going to work or thanking the author for telling you not to try and memorize this stuff.

A good goal would be to try and just about get it. This way, your understanding will become more rounded. You can then refer back to this chapter for a refresher when needed.

Tip

It doesn't matter if you don't completely understand everything in this chapter straight away! Keep on reading and make sure to complete all the apps and mini apps.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.6.77