Separators in Java

Symbol Name Description
() Parentheses Used in:

  1. method signatures to contain lists of arguments.
  2. expressions to raise operator precedence.
  3. narrowing conversions.
  4. loops to contain expressions to be evaluated
{} Braces Used in:

  1. declaration of types.
  2. blocks of statements
  3. array initialization.
[] Brackets Used in:

  1. array declaration.
  2. array value dereferencing
< > Angle brackets Used to pass parameter to parameterized types.
; Semicolon Used to terminate statements and in the for statement to separate the initialization code, the expression, and the update code.
: Colon Used in the for statement that iterates over an array or a collection.
, Comma Used to separate arguments in method declarations.
. Period Used to separate package names from subpackages and type names, and to separate a field or method from a reference variable.

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.