Friday 18 November 2016

DATA TYPES IN JAVA

The data type of a variable is an attribute that tells what kind of data that a value can have.
Java programming supports eight primitive types under the following four categories which are as under:

  1. Integers:The datatype integer is used to store the numbers other than real point numbers.
                  Under integer sub types are:                 
      • byte: The size of byte is 1 byte.
      • int:   The size of int is 4 bytes
      • long: The size of long is 8 bytes.
      • short:The size of short is 2 bytes.     
                 
     2. Real Numbers:
Real point numbers are also called as floating point numbers and hence needs to be stored in a data type different from integers

                  Under real number type, sub types are: 
                
                             
      • float:   The size of float is 4 bytes.
      • double: The size of double is  8 bytes         
        3. Characters:
                    
 Character datatype stores the characters and special Characters.The size of character data type   is 2 bytes.

       4.Boolean:
                   Boolean means that it can either store 0 or 1.The size of Boolean is 1 byte


    No comments:

    Post a Comment