Punctuators and Separators in Java

Let’s have a look at Punctuators and Separators:

Punctuators in java:

Punctuators are the punctuation signs used as special characters in Java. Some of the punctuators are: ‘? ’ (Question mark), ‘ : ‘ (colon), ‘ ; ‘ (semicolon), ‘.’ (Dot)

The most important punctuator is the semicolon ‘ ; ‘, because it is used as the statement terminator in Java, i.e. it marks the end of any statement in the program.

Separators in java:

They are the special characters used to separate the variable or characters in a Java Program.

E.g.:  Braces: ( ), { }, [ ] and Comma ‘ , ‘

Comma is used to separate multiple variables under the same declaration while the following are the use of braces:

  • Simple braces: ( ) are used to enclose any relational or mathematical expressions.
  • Curly Braces: { } are used to enclose a group of statements under a single statement.
  • Square Braces: [ ] are used to enclose the index number or cell number of a dimensional array. (To be read later)
Punctuators and Separators in Java