Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7004415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:11:46+00:00 2026-05-27T21:11:46+00:00

For example why can you do: int n = 9; But not: Integer n

  • 0

For example why can you do:

int n = 9;

But not:

Integer n = 9;

And you can do:

Integer.parseInt("1");

But not:

int.parseInt("1");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:11:47+00:00Added an answer on May 27, 2026 at 9:11 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example can I have class Dog { int legs; Bone chewy; Bone squeeky;
Example int *ptr; *ptr = 1000; can I catch memory access violation exception using
I can't seem to get a reliable timestamp using winapi functions. For example: int
Every example I can find is in C++, but I'm trying to keep my
Given an compile-time constant integer (an object, not a macro), can I combine it
I've searched Google and this website many times, but can not find a solution
For example can i have something like this: public static void SAMENAME (sameparameter n)
I couldn't find an answer - does NHibernate supports MsSql2008? For example - can
For example I can point the url '^/accounts/password/reset/$' to django.contrib.auth.views.password_reset with my template filename
For example DbVisualizer can be used to connect to a DB and create nice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.