Separators in Java

Separators help define the structure of a program. The separators used in HelloWorld are parentheses, ( ), braces, { }, the period, ., and the semicolon, ;. The table lists the six Java separators (nine if you count opening and closing separators as two).

Separator Purpose
( )Encloses arguments in method definitions and calling; adjusts precedence in arithmetic expressions; surrounds cast types and delimits test expressions in flow control statements
{ }defines blocks of code and automatically initializes arrays
[ ]declares array types and dereferences array values
;terminates statements
,separates successive identifiers in variable declarations; chains statements in the test, expression of a for loop
.Selects a field or method from an object; separates package names from sub-package and class names
:Used after loop labels


Previous | Next | Top
Last Modified September 24, 1999
Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu