Ver Mensaje Individual
  #4 (permalink)  
Antiguo 10/12/2012, 13:57
posman
 
Fecha de Ingreso: enero-2008
Mensajes: 614
Antigüedad: 16 años, 4 meses
Puntos: 57
Respuesta: ayudacon mi metodo? (devolver factorial)

Cita:
Iniciado por Fuzzylog Ver Mensaje
los tipos primitivos deben declararse inicializados con algún valor
Incorrecto. Es bueno hacerlo, pero no es necesario

De la documentacion de Oracle: (http://docs.oracle.com/javase/tutori...datatypes.html)

Cita:
Default Values

It's not always necessary to assign a value when a field is declared. Fields that are declared but not initialized will be set to a reasonable default by the compiler. Generally speaking, this default will be zero or null, depending on the data type. Relying on such default values, however, is generally considered bad programming style.

The following chart summarizes the default values for the above data types.
Data Type Default Value (for fields)
byte 0
short 0
int 0
long 0L
float 0.0f
double 0.0d
char '\u0000'
String (or any object) null
boolean false