Ver Mensaje Individual
  #5 (permalink)  
Antiguo 11/02/2012, 09:25
AAlejandroR
 
Fecha de Ingreso: enero-2012
Mensajes: 40
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: recibir array de objeto a metodo duda

y este error a que se debe??:
System.out.println("dist de punto:"+p1.calcularMasCercano(crear())
.toString());



}
public static Punto[] crear(){
Punto[] punt=new Punto[5];
for(int i=0;i<punt.length;i++){
punt[i].setX(Math.random()*10);
punt[i].setY(Math.random()*10);
System.out.println("Punto:"+i+"tiene el valor"+punt[i].toString());

}
return punt;

}

alcompilar pone este error :


Exception in thread "main" java.lang.NullPointerException
at FiguraGeometrica.Prueba.crear(Prueba.java:29)
at FiguraGeometrica.Prueba.main(Prueba.java:20)
y es sobre el math.random pero no entie ndo porque