Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/11/2013, 13:38
Avatar de Xerelo
Xerelo
 
Fecha de Ingreso: mayo-2009
Mensajes: 2.175
Antigüedad: 15 años
Puntos: 306
Respuesta: diferencia entre int y clase INTEGER

¿Por qué en vez de darle tantas vueltas a las cosas no vas a la documentación o a algún tutorial?

http://docs.oracle.com/javase/7/docs...g/Integer.html

Cita:
The 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 int.
http://docs.oracle.com/javase/tutori...erclasses.html

Cita:
There are, however, reasons to use objects in place of primitives, and the Java platform provides wrapper classes for each of the primitive data types. These classes "wrap" the primitive in an object. Often, the wrapping is done by the compiler—if you use a primitive where an object is expected, the compiler boxes the primitive in its wrapper class for you. Similarly, if you use a number object when a primitive is expected, the compiler unboxes the object for you. For more information, see Autoboxing and Unboxing
__________________
Cada vez que solucionas los problemas de alguien que no se esfuerza, piensa en que el día de mañana puede llegar a ser tu compañero de trabajo, o peor, tu jefe.