Last Updated on Tuesday, 28 June 2011 15:22
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.In addition, this class provides several methods for converting an
int to a
String and a
String to an
int, as well as other constants and methods useful when dealing with an
A java.lang.Integer costs 16 bytes. An int value can fit into just 4 bytes. Using an Integer costs 300 percent memory overhead compared to a primitive type.
By default Java parameters are always passed by values. An easy way to pass by reference is to use a single element array.
Let's define a Junit test case to illustrate an example :
Tags: java, type, memory, string, reference, integer, void, methods, costs, java.lang.integer, bytes, primitive