Integer Data Type In Java


Int Data Type ?

Keyword used for integer data types is int. Integers typically requires 4 bytes of memory space and ranges from -2147483648 to 2147483647(inclusive).


The integral data type is used to store integers and includes char (character) and int (integer) data types.

Int is generally used as the default data type for integral values unless there is a concern about memory.


Example 1:



Output :

 
  The sum of two int variables is: 24
  

Example 2:



Output :

The numeric array value : 5
The numeric array value : 10
The numeric array value : 15
The numeric array value : 20
The numeric array value : 25
The numeric array value : 30
The numeric array value : 35


Example 3:



Output :


 The sum of twolong variables is = 4294967298