🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Integer.html
Integer (Java Platform SE 8 )
October 20, 2025 - The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value or an ASCII plus sign '+' ('\u002B') to indicate a positive value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseInt(java.lang.String, int) method.
🌐
Tutorialspoint
tutorialspoint.com › home › java/lang › java integer class
Java Integer Class Overview
September 1, 2008 - An object of type Integer contains a single field whose type is int. Following is the declaration for java.lang.Integer class −
🌐
Programiz
programiz.com › java-programming › examples › print-integer
Java Program to Print an Integer (Entered by the User)
To understand this example, you ... Scanner(System.in); System.out.print("Enter a number: "); // nextInt() reads the next integer from the keyboard int number = reader.nextInt(); // println() prints the following line to the output screen System.out.println("You entered: " + number); ...
🌐
Oracle
docs.oracle.com › javase › 7 › docs › api › java › lang › Integer.html
Integer (Java Platform SE 7 )
The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value or an ASCII plus sign '+' ('\u002B') to indicate a positive value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseInt(java.lang.String, int) method.
🌐
DataCamp
datacamp.com › doc › java › int
int Keyword in Java: Usage & Examples
In this example, an array of integers intArray is initialized with five values.
🌐
Java
download.java.net › java › early_access › valhalla › docs › api › java.base › java › lang › Integer.html
Integer (Java SE 23 & JDK 23 [build 1])
Decodes a String into an Integer. Accepts decimal, hexadecimal, and octal numbers given by the following grammar: ... + DecimalNumeral, HexDigits, and OctalDigits are as defined in section 3.10.1 of The Java Language Specification, except that underscores are not accepted between digits.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-lang-integer-class-java
Java.lang.Integer class in Java - GeeksforGeeks
June 21, 2022 - Space of constants: It is just to imagine for better understanding that there is some space for constants in heap memory. Example: Integer x = 200; //initializing directly x = 300; //modifying x x = 10; //modifying x again ·
🌐
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › lang › Integer.html
Integer (Java SE 21 & JDK 21)
January 20, 2026 - The characters in the string must all be decimal digits, except that the first character may be an ASCII plus sign '+' ('\u002B'). The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseUnsignedInt(java.lang.String, int) method.
🌐
Dremendo
dremendo.com › java-programming-tutorial › java-integer-variable
Integer Variable in Java Programming with Examples | Dremendo
Type int - short form of the integer is the type of variable which is used to store a whole number, either positive or negative in Java programming. Example: 10, 89, -24 etc. But if you try to store a fractional value it then it will give loss ...
Find elsewhere
🌐
Oracle
docs.oracle.com › en › java › javase › 20 › docs › api › java.base › java › lang › Integer.html
Integer (Java SE 20 & JDK 20)
July 10, 2023 - The characters in the string must all be decimal digits, except that the first character may be an ASCII plus sign '+' ('\u002B'). The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseUnsignedInt(java.lang.String, int) method.
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java
Integer Java Class Example - Java Code Geeks
May 31, 2021 - The Integer Java class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › lang › Integer.html
Integer (Java SE 17 & JDK 17)
January 20, 2026 - The characters in the string must all be decimal digits, except that the first character may be an ASCII plus sign '+' ('\u002B'). The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseUnsignedInt(java.lang.String, int) method.
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-read-and-print-an-integer-value-in-java
How to Read and Print an Integer Value in Java - GeeksforGeeks
October 30, 2025 - Print the integer using ... for input System.out.print("Enter an integer: "); // Step 3: Read integer input int number = sc.nextInt(); // Step 4: Print the entered integer System.out.println("You entered: " + number); ...
🌐
Java Tutorial HQ
javatutorialhq.com › java tutorial › java.lang › integer
Java Integer Class Tutorial and Example
September 30, 2019 - To have a birds eye view of this scenario lets take a look on below example · Integer intValue = Integer.parseInt("2147483648"); As you would have noticed we have passed a method argument to parseint method that is +1 of the maximum value which certainly breached the threshold.
🌐
W3Schools
w3schools.com › java › java_data_types_numbers.asp
Java Numbers
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... Integer types stores whole numbers, positive or negative (such as 123 or -456), ...
Top answer
1 of 11
419

int is a primitive type. Variables of type int store the actual binary value for the integer you want to represent. int.parseInt("1") doesn't make sense because int is not a class and therefore doesn't have any methods.

Integer is a class, no different from any other in the Java language. Variables of type Integer store references to Integer objects, just as with any other reference (object) type. Integer.parseInt("1") is a call to the static method parseInt from class Integer (note that this method actually returns an int and not an Integer).

To be more specific, Integer is a class with a single field of type int. This class is used where you need an int to be treated like any other object, such as in generic types or situations where you need nullability.

Note that every primitive type in Java has an equivalent wrapper class:

  • byte has Byte
  • short has Short
  • int has Integer
  • long has Long
  • boolean has Boolean
  • char has Character
  • float has Float
  • double has Double

Wrapper classes inherit from Object class, and primitive don't. So it can be used in collections with Object reference or with Generics.

Since java 5 we have autoboxing, and the conversion between primitive and wrapper class is done automatically. Beware, however, as this can introduce subtle bugs and performance problems; being explicit about conversions never hurts.

2 of 11
10

An Integer is pretty much just a wrapper for the primitive type int. It allows you to use all the functions of the Integer class to make life a bit easier for you.

If you're new to Java, something you should learn to appreciate is the Java documentation. For example, anything you want to know about the Integer Class is documented in detail.

This is straight out of the documentation for the Integer class:

The Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.

🌐
CodeGym
codegym.cc › java blog › java classes › java.lang.integer class
Java.lang.Integer Class
February 20, 2025 - They can be positive, negative or 0. Unfortunately, Integer in Java does not mean any whole number. Integer in java is a whole number that fits in 32 bits. If you want a larger number you are welcome to use Java Long numbers. They have 64 bits at their disposal.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › int-vs-Integer-java-difference-comparison-primitive-object-types
Integer vs. int: What's the difference?
While there is really only one way to initialize an int directly, you can initialize Integer types in Java multiple ways, including: Through a Java constructor. From the value of a String. With the help of autoboxing. Here are three examples of how to declare and initialize an Integer vs an int in Java:
🌐
Oracle
docs.oracle.com › en › java › javase › 24 › docs › api › java.base › java › lang › Integer.html
Integer (Java SE 24 & JDK 24)
July 15, 2025 - The characters in the string must all be decimal digits, except that the first character may be an ASCII plus sign '+' ('\u002B'). The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseUnsignedInt(java.lang.String, int) method.
🌐
Home and Learn
homeandlearn.co.uk › java › java_int_variables.html
java for complete beginners - variables: the int type
So this tells java that we want to store a value of 10 in the integer variable that we've called first_number.