What are separators in java?
Separators help elaborates the structure of a program. The separators used within HelloWorld are parentheses, ( )
, braces, { }
, the period, .
, and the semicolon, ;
. The table lists the six Java separators (nine if you count closing and opening separators as two).
Separator Purpose
|
( )
|
Encloses arguments in methods definitions and calling; adjusts precedence in arithmetic expressions; surrounds cast kinds and delimits test expressions in flow control statements
|
{ }
|
describe blocks of code and automatically initializes arrays
|
[ ]
|
declares array kinds and dereferences array values
|
;
|
terminates statements
|
,
|
separates successive identifiers within variable declarations; chains statements within the test, expression of a for loop
|
.
|
Selects a field or methods from an object; separates package names from sub-package and class names
|
:
|
Used after loop labels
|