Scanner sc=new Scanner(new File("abc.txt")); int c=1; FileWriter fw =new FileWriter("sf.txt"); while(sc.hasNextLine()){ String s=c+sc.nextLine(); fw.write(s+"\r\n"); fw.flush(); c++; } fw.close(); sc.close()
← 上一条:使用java输入输出流将c盘根目录下的gou 下一条:Java中怎么读入一行输入空格隔开的多个数据 →