Skip to main content

JAVA: Separators.

JAVA.

Do you wanted to know what is separators? where in the program we use the separators? Read the following carefully and completely to understand.

SEPARATORS.
            Separators are special characters in java, which is used to separate the variables or character in the program.

They are also called as Punctuators

We have many separators. Following i mentioned some of the them.

     Separators.                             Description        Example
 comma  ,Used to separate multiple variable
under same declaration. 

public void display()
{
int a,b,c;
......
}
 
 Braces  ( )Used to enclose a relational or arithmetic
expression 

public void display()
{
int a,b,c;
c=a*(b+20);
}

 Square brackets  [ ]  Used to enclose subscript or cell number of a
dimensional array.

public void display()
{
int a[]=new int[10];
}
 
 Curly brackets  {} Used to enclose a group of statement under a 
component statement.

public void display()
{
int a,b,c;
......
}

 Dot  .  Used to represent  the scope of the function
public void display()
{
int a,b,c;
System.out.println(a);
}

 Semi colon  ; Used in java program to  terminate the program.
public void display()
{
int a,b,c;
......
}

 Question mark  ? Used in java program as a conditional statement.
public void display()
{
int a=5,b=10,c;
c=(a>b)?a:b;
}






Check out the interesting history of Java.

The important features of java.

The structure of java.

The environment of java.

Also the complete process to execute java program.

check out other tokens:

                identifier.
               keywords.
               constants.
               datatypes.
                variables.

Comments