如果你在里面的价格我把它转换成整数..但它只说文件输入错误,这意味着停止,我认为数据传输有问题。它实际上是在字符串中工作。请帮忙
int a=0 price=0;
while(DI.available()!=0)
{
System.out.println("Barcode: " + DI.readLine());
a+=1;
System.out.println("Product Name: " + DI.readLine());
a+=1;
price = Integer.parseInt(DI.readLine());
System.out.println("Price: " + price);
System.out.println("");
}
if(a<=1)
{
System.out.println("No record");
}
DI.close();
}
catch(Exception e)
{
System.out.println("File input error");