int Datatype in Java

Java Programming Language / DataTypes in java

2644

  • Int data type is a 32-bit signed two's complement integer.

  • Minimum value is - 2,147,483,648 (-2^31)

  • Maximum value is 2,147,483,647(inclusive) (2^31 -1)

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

  • The default value is 0

  • Example: int a = 100000, int b = -200000

Program:

 public class IntDataType {

   public static void main(String []args) {
      // this is declaration and initialization of variable a
	  // datatype is int
	  int a = 10000;
	  // this is declaration and initialization of variable b
	  // datatype is int
      int b = -5000;
      System.out.println(a); // it will print a variable
      System.out.println(b); // it will print b variable
   }
}

  

Output:

10000
-5000
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.