Java System.out.println()调用被忽略,并且元素未添加到ArrayList中?

Java System.out.println()调用被忽略,并且元素未添加到ArrayList中?,java,arraylist,bufferedreader,println,Java,Arraylist,Bufferedreader,Println,我目前正在开发一个程序,从文本文件中读取信息,并使用Apache的POI将其输出到电子表格中 让我给你看看我有什么 ExcelFile ef = new ExcelFile(file, "the destination"); ExcelFileObject的构造函数: public ExcelFile(File file, String fp){ System.out.println("Entered ExcelFile construct

我目前正在开发一个程序,从文本文件中读取信息,并使用Apache的POI将其输出到电子表格中

让我给你看看我有什么

    ExcelFile ef = new ExcelFile(file, "the destination");
ExcelFileObject的构造函数:

    public ExcelFile(File file, String fp){
    System.out.println("Entered ExcelFile constructor");
    util = new ExcelUtilities();
    this.filepath = fp;
    this.data = util.readFromFile(file);
}
然后是readFromFile方法:

public ArrayList<InputData> readFromFile(File file){
    System.out.println("Entered readFromFile in ExcelUtilities");
    ArrayList<InputData> data = new ArrayList<InputData>();
    try {
        BufferedReader br = new BufferedReader(new FileReader(file));
        String line = "";
        while((line = br.readLine()) != null){
            if(line.length() > 0){
                System.out.println(line);
                int x = Integer.parseInt(br.readLine());
                System.out.println(x);
                int y = Integer.parseInt(br.readLine());
                System.out.println(y);
                data.add(new InputData(line, x, y)); //Not adding the first thing read in for some odd reason.
            }
        }
        br.close();
        return data;
    }catch (NumberFormatException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}
public ArrayList readFromFile(文件){
System.out.println(“在ExcelUtilities中输入readFromFile”);
ArrayList数据=新的ArrayList();
试一试{
BufferedReader br=新的BufferedReader(新文件读取器(文件));
字符串行=”;
而((line=br.readLine())!=null){
if(line.length()>0){
系统输出打印项次(行);
intx=Integer.parseInt(br.readLine());
系统输出println(x);
int y=Integer.parseInt(br.readLine());
系统输出打印项次(y);
data.add(new InputData(line,x,y));//由于一些奇怪的原因没有添加第一个读入的内容。
}
}
br.close();
返回数据;
}捕获(数字格式){
e、 printStackTrace();
返回null;
}捕获(IOE异常){
e、 printStackTrace();
返回null;
}
}
我遇到的问题是.txt文件中格式正确的第一个对象没有添加到ArrayList数据中。当我在调试器中运行(使用Eclipse)时,我注意到它正在读取第一行、x和y值,但从未实际将对象存储在
数据中

然后我遇到了一个更奇怪的问题。我添加了System.out.println()语句作为另一个验证级别,以验证文件中的数据是否被正确读入,甚至没有打印到控制台上!我试着运行另一个包含println()的项目,它们运行得很好

所以,我想主要的问题是为什么添加的文件的第一个主菜不是ArrayList?接下来是为什么println()调用没有显示在Eclipse的控制台上

输出中选定的框是“Hello”应该放置的位置


请发布程序的完整输出。@TimothyTruckle好的,为示例输入和相应输出添加了图片。还有很多,但其他的都很好。你在控制台中看到了什么?显示
InputData
类以及如何输出它。什么都没有。在添加println()进行测试之前,控制台中没有任何内容。但是,让我困惑的是,现在我已经添加了它们,仍然没有显示任何内容。