Java Int Example Program
Chapter:
Data Types
Last Updated:
06-07-2016 04:08:43 UTC
Program:
/* ............... START ............... */
public class JavaIntExample {
public static void main(String[] args) {
int i = 0;
int j = 10;
System.out.println("Int variable i is :" + i);
System.out.println("Int variable j is :" + j);
}
}
/* ............... END ............... */
Output
Int variable i is :0
Int variable j is :10
Notes:
-
Int is 32 bit signed type ranges from –2,147,483,648 to 2,147,483,647.
- Int is also most commonly used integer type in Java.
- Int Declaration : int <variable name> = <default value>;
- Int data type is a 32-bit signed two's complement integer, which has a minimum value of -231 and a maximum value of 231-1.
Tags
Java Int Example