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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:49:32+00:00 2026-06-04T19:49:32+00:00

Possible Duplicate: How are Integer arrays stored internally, in the JVM? In C#, when

  • 0

Possible Duplicate:
How are Integer arrays stored internally, in the JVM?

In C#, when you are creating a new array which is a reference type so it puts a pointer onto Stack and object itself in Heap. If you create this array with simple primitive types such as int, double, etc. what it does is to put the values exactly where they are placed in Heap instead of a pointer which points at another heap address where the content of it stored.

So can someone please explain how this happens in Java? Java use Integer (a reference type) in arrays all the time or treats value types as C# does?

int[] hello = new int[5];
hello[0] = 2; // C# put this value directly in same slot and doesn't 
//create a wrapping object.

I know a thing which is called Wrapping Types in Java which C# doesn’t have. C# has auto-boxing but Int32 lets say not an reference type, but ValueType where as Integer is an object as opposed to int. You can either box a value using Object o = 5; or if struct does have a parent class, you can use it too to wrap it up in heap (boxing).

  • 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-04T19:49:33+00:00Added an answer on June 4, 2026 at 7:49 pm

    Java is much the same as you describe.

    int[] hello = new int[5]; // reference hello is on stack, the object is on the heap.
    hello[0] = 2; // Java puts this value directly in same slot and doesn't 
                  // create a wrapping object.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Unique random numbers in O(1)? How do I fill an integer array
Possible Duplicate: What’s the reason I can’t create generic array types in Java? HashSet<Integer>[]
Possible Duplicate: C pointer to array/array of pointers disambiguation In C, is int *thing[5]
Possible Duplicate: .NET Integer vs Int16? Which is faster for large numbers of tests
Possible Duplicate: New Integer vs valueOf I read at few place that Integer.valueOf is
Possible Duplicate: way to get specific integer(s) from a double data type C++ So
Possible Duplicate: Java Generics: Array containing generics I have a Java class which contains
Possible Duplicate: Which is the first integer that an IEEE 754 float is incapable
Possible Duplicate: Haskell Error: Couldn't match expected type Integer&#39; against inferred type Int' How
Possible Duplicate: Find integer not occurring twice in an array Accenture interview question -

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.