At the time of calling a method, from another class, which prints the class array gives me error
called the method this is the method:
public static void tecOpciones() {
int valores = 0, selec;
do {
do {
selec = Integer.parseInt(JOptionPane.showInputDialog("Seleccione una opcion:\n1. Reportes \n2. Realizar reparacion \n3 salir "));
if (selec >= 1 && selec <= 3) {
valores = 1;
} else {
JOptionPane.showMessageDialog(null, "Opcion invalida, vuelva intentarlo ");
}
} while (valores == 0);
if (selec == 1) {
//revision de reportes
Rutinas2 r = new Rutinas2();
r.mostRepor();
} else if (selec == 2) {
//metodo que dirige a la opcion de tecnico
} else if (selec == 3) {
valores = 2;
}
} while (valores != 2);
}
This is where I fill the object and print it
public class Rutinas2 {
private String s;
int z = 2;
private class3 arreglo3[] = new class3[z];
public void llenarClass3() {//metodo para llenar la clase 3
Random alea = new Random();
int n = 1000 + alea.nextInt(1999);
int x;
for (x = 0; x < arreglo3.length; x++) {
class3 u = new class3();
u.setDaño(JOptionPane.showInputDialog(null,
"Ingrese el daño a reportar"));
u.setPrioridad((String) JOptionPane.showInputDialog(null, "Seleccione la prioridad",
"Prioridad", JOptionPane.QUESTION_MESSAGE, null,
new Object[]{"Seleccione", "Alta", "Media", "Baja"}, "Seleccione"));
u.setFecha(JOptionPane.
showInputDialog(null,
"Desde cuando presenta este problema"));
u.setObservacion(JOptionPane.showInputDialog(null,
"Observaciones adicionales"));
u.setGuia(n);
JOptionPane.showMessageDialog(null,
"Su numero de reporte es: " + n);
arreglo3[x] = u;
}
}
public void mostRepor() { //metodo muestra todos los reportes hechos por los usuarios
s = "";
int y;
for (y = 0; y < z; y++) {
s = s + (y + 1) + "." + arreglo3[y].getDaño() + " " + arreglo3[y].getPrioridad()
+ " " + arreglo3[y].getObservacion() + " " + arreglo3[y].getGuia() + "\n";
}
JOptionPane.showMessageDialog(null,
"Reportes \n" + s);
}