BufferedReader skipping each second line

柔情痞子 提交于 2019-12-02 09:02:06

Its skipping every second line because you are reading two lines in every iteration and only using the odd ones.

I suggest instead using

while ((thisLine = reader.readLine()) != null) { // only read once per loop.
    String propertyDetails[] = thisLine.split(",");
    if (propertyDetails[0].equals(userName)) {
        System.out.print("\nUser: " + propertyDetails[0] + "\nAddress: " + propertyDetails[1] + "\nEst. Value: " + propertyDetails[2]
                + "\nLocation Cat: " + propertyDetails[3] + "\nPrivate Residence: " + propertyDetails[4] + "\nTax Paid: " + propertyDetails[5] + "\nTax Due: " + propertyDetails[6] + breakLine);

    }
}
// out side the loop.
System.out.print("\nNo Further Properties Found For This User\n");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!