I copy and paste (it seems to me more comfortable than an image) the code.
package nueve;
import java.util.Scanner;
public class nueve {
Scanner sc = new Scanner (System.in);
private int arreglo;
private int AñoEdad=2017;
private String AlumnoMayorEdad;
private int Año1, Año2;
String Nombres [] ;
int Legajo [] ;
int AñoNacimiento [];
public nueve() {
System.out.println("Ingrese la cantidad de Alumnos: ");
arreglo=sc.nextInt();
String Nombres [] = new String [arreglo];
int Legajo [] = new int [arreglo];
int AñoNacimiento [] = new int [arreglo];
}
public void cargardatos() {
for (int i=0; i<arreglo; i++ ){
System.out.println("Ingrese nombre de alumno: ");
Nombres [i] = sc.next();
System.out.println("Ingrese el legajo del alumno " + Nombres[i] + ": ");
Legajo [i] = sc.nextInt();
System.out.println("Ingrese año de nacimiento del alumno " + Nombres[i] + ": ");
AñoNacimiento [i] = sc.nextInt();
}
}
public void CualEsElDeMayorEdad(){
for (int i=0; i<arreglo; i++){
if (AñoNacimiento[i]<AñoEdad){
AlumnoMayorEdad=Nombres[i];
AñoEdad=AñoNacimiento[i];
}
}
}
public String DimeEdad(){
return "El alumno de mayor edad es: " + AlumnoMayorEdad;
}
public void EntreAños(){
System.out.println("Ingrese los dos años, primero el mayor edad: ");
Año1=sc.nextInt();
Año2=sc.nextInt();
for (int i=0; i<arreglo; i++){
if (AñoNacimiento[i]> Año1 && AñoNacimiento[i]<Año2){
System.out.println("El alumno " + Nombres[i] + " esta entre esos años");
}
}
}
}
package nueve;
public class uso_nueve {
public static void main(String[] args) {
nueve desempeño = new nueve();
desempeño.cargardatos();
desempeño.CualEsElDeMayorEdad();
desempeño.DimeEdad();
desempeño.EntreAños();
}
}
** THE PROBLEM IS WHEN I ENTER THE NAME OF THE FIRST STUDENT: Exception in thread "main" java.lang.NullPointerException. I STILL DO NOT HAVE EXCEPTION KNOWLEDGE. FORGIVENESS FOR IGNORANCE, SHOULD BE A PAVADA THAT I DO NOT REALIZE **
I HOPE THAT YOU CAN HELP ME, I LEAVE THE STATEMENT YOU LEFT ME: Load three vectors containing file, name of the student and year of birth. Make a query by name and determine which is the oldest student. Enter two dates (only the year) and show all the students who were born between those years.