站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Tutorial 5.0 英文版

Object-Oriented Programming Concepts - Java Tutorial 5.0 英文版

The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Trail: Learning the Java Language

Lesson: Object-Oriented Programming Concepts


This chapter has been updated to reflect features and conventions of the latest release, JDK 5.0. If you notice any errors or omissions (or something you really like), please tell us.
If you've never used an object-oriented language before, you need to understand the underlying concepts before beginning to write code. You need to know what an object is, what a class is, how objects and classes are related, and how objects communicate by using messages. The first few sections of this chapter describe the concepts behind object-oriented programming. The last section shows how these concepts translate into code.

What Is an Object? (in the Learning the Java Language trail)

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? (in the Learning the Java Language trail)

Software objects interact and communicate with each other using messages.

What Is a Class? (in the Learning the Java Language trail)

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? (in the Learning the Java Language trail)

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? (in the Learning the Java Language trail)

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? (in the Learning the Java Language trail)

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 (in the Learning the Java Language trail)

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

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.