The JavaTM Tutorial

| Start of Tutorial > Start of Trail | Search Feedback Form

Trail: Learning the Java Language

## Lesson: Object-Oriented Programming Concepts

> If you've never programmed using an object-oriented language before, you need to understand what objects and classes are and how these concepts translate to code.

> This lesson provides the conceptual basis for object-oriented languages in general. The last section shows you how these general concepts translate into code for an applet written in the Java programming language.

### What Is an Object?

> An object is a software bundle of related variables and methods. Software objects are often used to model real-world objects you find in everyday life.

### What Is a Message?

> Software objects interact and communicate with each other using messages.

### What Is a Class?

> A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind.

### What Is Inheritance?

> A class inherits state and behavior from its superclass. Inheritance provides a powerful and natural mechanism for organizing and structuring software programs.

### What Is an Interface?

> An interface is a contract in the form of a collection of method and constant declarations. When a class implements an interface, it promises to implement all of the methods declared in that interface.

### How Do These Concepts Translate into Code?

> This section looks at a small applet, and shows you the code that creates objects, implements classes, sends messages, establishes a superclass, and implements an interface.

### Questions and Exercises: Object-Oriented Concepts

> Test your understanding of objects, classes, messages, and so on by doing some exercises and answering some questions.

| Start of Tutorial > Start of Trail | Search Feedback Form