Method giving error when returning value

Asked

Viewed 47 times

0

I’m making the following mistake:

cannot find simbol.

He gives in the method Return, I checked my code and could not locate anything wrong.

Follow the code below:

 public ArrayList<String> verificarUsuario(){

    try {
        FileInputStream arquivo = new FileInputStream(caminho+"\\administrador.txt");
        InputStreamReader entrada = new InputStreamReader(arquivo);
        BufferedReader ler = new BufferedReader(entrada);
        String linha; 
        ArrayList<String>dados = new ArrayList<String>();
        do{
            linha = ler.readLine(); 

             if(linha!=null){
                 String[]palavra = linha.split(";");

                    for(int i =0;i<palavra.length;i++){
                      dados.add(palavra[i]); 

                   }
            }
       }
       while(linha!=null);

         arquivo.close();


    } catch (FileNotFoundException ex) {
        JOptionPane.showMessageDialog(null, "Erro: Arquivo não encontrado!");
    }catch(IOException err){
       JOptionPane.showMessageDialog(null, "Erro: "+err.getMessage());
    }        

     return dados;
}
  • 1

    Put a space between ArrayList<String> and dados, see if it works.

  • 1

    Young man, I’ll give you some tips to write a question: 1. Try to put a title that gives an explanation about your problem, nothing so abstract; 2. Don’t forget to let us know what language; 3. Explain your problem better, calmly. You can always improve your publication by clicking on [Dit]

  • I managed to fix it here already, I used the Netbeans patch that asked to create the data field in the class.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.