Chapter 2. Object-Oriented Programming Concepts

IF you’ve never used an object-oriented programming language before, you’ll need to learn a few basic concepts before you can begin writing any code. This chapter will introduce you to objects, classes, inheritance, interfaces, and packages. Each discussion focuses on how these concepts relate to the real world while simultaneously providing an introducion to the syntax of the Java programming language.

What Is an Object?

Objects are key to understanding object-oriented technology. Look around right now and you’ll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.

Real-world objects share two characteristics: They all have state and behavior. Dogs have ...

Get The Java™ Tutorial Fourth Edition: A Short Course on the Basics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.