Separators in Java

Following are the some characters which are generally used as the separators in Java.

Separator

Name

Use

.

Period

It is used to separate the package name from sub-package name & class name. It is also used to separate variable or method from its object or instance.

,

Comma

It is used to separate the consecutive parameters in the method definition. It is also used to separate the consecutive variables of same type while declaration.

;

Semicolon

It is used to terminate the statement in Java.

()

Parenthesis

This holds the list of parameters in method definition. Also used in control statements & type casting.

{}

Braces

This is used to define the block/scope of code, class, methods.

[]

Brackets

It is used in array declaration.

Separators in Java

 

Share