Class: Declaring Member Variables

Declaring Member Variables

  • Field declarations are composed of three components, in order: 1. Zero or more modifiers, such as public or private. 2. The field's type. 3. The field's name.
  • There are several kinds of variables: member variables in a class (fields), variables in a method or block of code(local variables), variables in method declarations (parameters).
  • All variables must have a type. You can use primitive types such as int, float, boolean, etc. Or you can use reference types, such as strings, arrays, or objects.

Related concepts

Class: Declaring Member Variables — Structure map

Clickable & Draggable!

Class: Declaring Member Variables — Related pages: