Separators in Java: Comma, period, semicolon, parentheses, braces, brackets

Here are the separators used in Java:

1) Comma separator , It is used to separate identifiers in a variable declaration. It is also used to put statements together in for statement.

2) Period separator . To separate a variable or method from a reference variable and to separate package names from sub packages.

3) Semicolon ; It is used to terminate a statement.

4) Parentheses ( ) To contain list of parameters in method definition. It is also used ot define precedence in control statements.

5) Braces { } It is used to contain value of arrays. It is also used to define blocks of code.

6) Brackets [ ] It is used to declare types of array and to dereference values of array.

Leave a Reply