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 8089023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:16:24+00:00 2026-06-05T19:16:24+00:00

In my code there are a lot of final values, like 10000. They never

  • 0

In my code there are a lot of final values, like 10000. They never change, i do nothing with them, just sometimes checks like if(number1 == number2).

Is it better to use int or Integer for such numbers?

  • 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-06-05T19:16:26+00:00Added an answer on June 5, 2026 at 7:16 pm

    In your case, use int.

    In a general case, if you’re in the situation where you could feasibly use either the primitive value is almost always preferred:

    • They’re potentially more memory efficient
    • You can always use == reliably, which isn’t the case with the class Integer type – you’d have to use .equals() to ensure you were getting what you wanted. See here for more details.

    Memory requirements are a lot less of an issue these days, but the big gotcha is the second one, which can cause the potential for a lot of bugs if you’re not aware of it (especially since there’s cases where == will work as you expect, and others where it won’t – it’s not a “reliable” bug in that sense.)

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

Sidebar

Related Questions

I'm working on some legacy code with a lot of code like private final
Although there are a lot of jquery autocomplete code in this forum. However I
There are a lot of posts on here about this, I'm using this code
I'm writing some code that has a lot of substitution. There's a list<char> productions
In my code there are some calls to a method that set the values
I see a lot of legacy code like this: class A { public static
I've just come across some code that's confusing me slightly; there are really 2
We have a lot of class code which has some boilerplate like the following:
In the code there exists exactly one type that implements IResourceConverter. That's what the
Hi in my code there is a dictionary of dictionary. nrec={'bridge': 'xapi1', 'current_operations': {},

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.