I searched for this error on StackOverflow but any topic seens to solve my problem. I have this code that opens a .txt file and inicialize objects variables and this error appears.
public void lerDoArquivo() {
try {
FileReader ler = new FileReader("Menu_de_itens.txt");
BufferedReader reader = new BufferedReader(ler);
String linha;
while ((linha = reader.readLine()) != null) {
processaEntrada(linha);
}
reader.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
This is my stracktrace:
Exception in thread "main" java.lang.NullPointerException
at java.io.FileInputStream.<init>(FileInputStream.java:130)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at java.io.FileReader.<init>(FileReader.java:58)
at ItemMenuDAOTxt.lerDoArquivo(ItemMenuDAOTxt.java:22)
at ItemMenuDAO.<init>(ItemMenuDAO.java:16)
at ItemMenuDAOTxt.<init>(ItemMenuDAOTxt.java:14)
at ControleDeMenu.<init>(ControleDeMenu.java:21)
at FastFoodOO.main(FastFoodOO.java:11)