Int Datatype Example Java Program


By default, the 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. In Java SE 8 and later, you can use the int data type to represent an unsigned 32-bit integer, which has a minimum value of 0 and a maximum value of 232-1. Use the Integer class to use int data type as an unsigned integer.


int varibale_name = integer_value;

Syntax Example

int gear = 1;

Int Datatype Example Program

class IntDatatype{
	public static void main(String[] args){
		int num1=0;
		int num2=2147483647;
		System.out.println("The smallest Integer value is: "+num1);
		System.out.println("The largest Integer value is: "+num2);

Sample Output

Output is:
The smallest Integer value is: 0
The largest Integer value is: 2147483647