Java Integer Variable

Java Integer Variable


Integer Variable In Java
The int data type can store numbers from -2147483648 to 2147483647.
The int data type is the preferred data type when we create variables with a numeric value, and when the space required by inputting value is 4 byte or less.
int keyword is used to declare the integer type variables .
Integer is a keyword it means it will always be written in small case.
 
Example 1 - 
int num =24234;
System.out.println(num);

 
Example 2 - Now we will see the use of int() method 
We can use (int) method to convert a variable into integer type value. 
int num =(int)242.34;
System.out.println(num);

 
Output - 
 
242