In case of Java when we write something like
Integer i = new Integer(20);
In the above case the obj is allocated on the heap
and in case of C#
Int32 i = new Int32();
i=10;
In this case the object is allocated on the stack
Are these just the difference in implementation wise or there are more differences too?
Correction: changed Integer to Int32 for C#
There is no
Integerin C#, its either int or int32 and both are same. With respect to C# saying “Value types go to stack” is some what not correct. You need to see this article from Eric Lippert:The Truth About Value Types
Edit: based on comment:
Int32 and int are same, the two are synonymous.