Summary of Example Classes from Day1 and Day2

The descriptions in this document are models of class descriptions for the users of the class. However, most of these descriptions are abbreviated, listing only the instance variables and methods that are actually used in the Day1 and Day2 examples. For a complete description of a class, see the Keyboard Class Description.

Class System

Instance Variables Methods See the description of the System class on Page 744 of Lewis and Loftus of other methods. They perform system tasks like configuring security managers, getting system time, loading libraries, etc.

 

Class Coin

Constructor Methods  

Class JOptionPane

import javax.swing.JOptionPane;

Static Methods

 

Class String

Constructor Methods For more methods, see page 739 of Lewis and Loftus.

 

Class Integer

The class Integer is an example of a wrapper class. We may or may not cover wrapper classes later in this course. What interests us now are its static instance variables.

Static Instance Variables

The classes Byte, Boolean, Char, Float, Long, and Short are also available. Each of these classes contains MAX_VALUE and MIN_VALUE instance variables. See the descriptions of these classes in Appendix M of Lewis and Loftus for more details, including methods.

Class Keyboard

import cs1.Keyboard;

IMPORTANT: To use the Keyboard class, get the disk that came with Lewis and Loftus and copy the copy the cs1.jar file from the Keyboard folder on the CD drive to the folder \jdk1.3\jre\lib\ext on your computer. Here is cs1.jar if you prefer to download it from here.

The Keyboard class inputs characters from the keyboard, and interprets it as whitespace delimited pieces of data. Whitespace consists of the characters ' ', '\t', '\r', '\n', '\f'.

Static Methods

 

Class Math

The Example Math in Day2 should be self explanatory.

 

Class DecimalFormat

Constructor Methods  

Class Applet

Although we will postpone a detailed discussion of inheritance until after the midterm exam, for now if a class B inherits a class A, the class B has all the functionality of A with the extra functionality provided in B. We say that B is a derived class with the base class A. If B ® A means that B is derived from A, the Applet class has the following inheritance hierarchy:
Applet® Panel ® Container ® Component ® Object.

Constructor

Methods

Class Color

Static Color Constants See Lewis and Loftus on Page 646 for more color constants.

Constructors

See Lewis and Loftus on Page 646 for more Color methods.

Class Graphics

Methods