previous | start | next

Syntax 3.1: Constant Definition

 Example:  Purpose:

   In a method:
final typeName variableName= expression ;
In a class:
accessSpecifier static final typeName variableName = expression;

Example:

  final double NICKEL_VALUE =0.05;
public static final double LITERS_PER_GALLON =3.785;

Purpose:

To define a constant of a particular type


previous | start | next