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

Similar Programs Chapter Last Updated
Java String Example Program Data Types 19-06-2016
Primitive Datatypes In Java Example Data Types 17-06-2016
Enum In Java Example Data Types 28-04-2016
Java Short Example Program Data Types 10-06-2016
Java Long Example Program Data Types 15-07-2016
Int Array In Java Example Program Data Types 09-06-2016
Java Float Program Example Data Types 28-03-2017
Java Double Example Program Data Types 28-03-2017
Java Char Example Program Data Types 28-03-2017
Java Byte Example Program Data Types 28-03-2017
Java Boolean Example Program Data Types 28-03-2017

1