Slide 3 of 57Lecture 2: Using Objects 
PreviousNextOverview

Syntax 2.1: Variable Definition

  typeName variableName = value;
or
 typeName variableName;

Example:

  String greeting = "Hello, Dave!";

Purpose:

To define a new variable of a particular type and optionally supply an initial value