0
I’m working with file manipulation and I’m not able to compare what the user types with the password and login saved in the person’s registration file! I can’t get a specific position inside the .txt
public class Validacao {
public static Aluno validarlogin() throws IOException {
    Aluno alu = new Aluno();
    Scanner logusuario = new Scanner(System.in);
    System.out.println("Digite seu nome completo: ");
    alu.nome = logusuario.nextLine();
    String nomearq = alu.nome + ".txt";
    BufferedReader br = new BufferedReader(new FileReader(nomearq));
    String linha = ";";
    while ((linha = br.readLine()) != null ){
        String[] vet = nomearq.split(";");
            if(alu.login.equals(vet[1]) && alu.senha.equals(vet[2])){
                System.out.println("Senha correta! ");
                alu.login(vet[2]);
                alu.senha(vet[3]);
            }
    }
    return alu;
}
With this code I get this error:
Exception in thread "main" java.lang.Arrayindexoutofboundsexception: 1
But there should be 12 strings in mine .txt
At the time of saving the record I saved by separating with ;.
And the split() was to pass the data of the .txt for a ArrayList wasn’t?
Show your txt content. The error reported is because you are accessing an invalid vector index
vet.– user28595