Website For Developers

Data types in Java



Example of data types in Java

public class DataTypes {

   public static void main(String[] args) {
     short var_short = 10;
     int var_int = 100;
     double var_double = 25.5;
     char var_char = 'A' ;
     boolean is_true = true;

     System.out.println( var_short );
     System.out.println( var_int );
     System.out.println( var_double );
     System.out.println( var_char );
     System.out.println( is_true );
   }
}

Output

10
100
25.5
A
true