for(int ctr = 0; ctr< 5;ctr++)
{
System.out.print("enter the name of the shoes: ");
title = keyboard.nextLine();
System.out.print("Enter purchase price: ");
purchasePrice = keyboard.nextDouble();
System.out.print("Enter colletible price: ");
collectiblePrice = keyboard.nextDouble();
writeFile.write(title);
writeFile.newLine();
writeFile.write(String.valueOf(purchasePrice));
writeFile.newLine();
writeFile.write(String.valueOf(collectiblePrice));
writeFile.newLine();
title = keyboard.nextLine();
}
这几个代码为何不能把五次数据都写入datafile里?。。。
{
System.out.print("enter the name of the shoes: ");
title = keyboard.nextLine();
System.out.print("Enter purchase price: ");
purchasePrice = keyboard.nextDouble();
System.out.print("Enter colletible price: ");
collectiblePrice = keyboard.nextDouble();
writeFile.write(title);
writeFile.newLine();
writeFile.write(String.valueOf(purchasePrice));
writeFile.newLine();
writeFile.write(String.valueOf(collectiblePrice));
writeFile.newLine();
title = keyboard.nextLine();
}
这几个代码为何不能把五次数据都写入datafile里?。。。