Utilities and Wrappers

A utility class contains static method and variable declarations.

Static methods and variables are contained in the declaring class, not in the objects constructed from the class.

We can access a static variable by qualifying it with the class name:

class.variable

We can invoke a static method by asking the containing class to execute it:

class.method(inputs)

System

The System class contains System.in, a static object representing the standard input stream (keyboard) and System.out, a static object representing the standard output stream (the command console window).

See TestUtil.java

Math

The Math class contains useful mathematical functions and constants.

See TestMath.java

Integer

Every primitive value (int, double, char, boolean) can be encapsulated in an object called a wrapper. This is called boxing. Removing a primitive value from its wrapper is called unboxing.

Wrappers can be used in situations where objects are expected.

Java performs boxing and unboxing automatically.

See TestInteger.java