Attributes and Behavior

A Java class consists of two distinct types of information: attributes and behavior.

Both of these are present in VolcanoRobot, a project you will implement today as a class. This project, a computer simulation of a volcanic exploration vehicle, is patterned after the Dante II robot used by NASA's Telerobotics Research program to do research inside volcanic craters.

Attributes of a Class of Objects

Attributes are the data that differentiates one object from another. They can be used to determine the appearance, state, and other qualities of objects that belong to that class.

A volcanic exploration vehicle could have the following attributes:

  • Status—exploring, moving, returning home

  • Speed, in miles per hour

  • Temperature, in ...

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition 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.