java读取记事本列并保存
一夜千次狼
package notepad_read;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException;import java.util.Scanner;public class 读取记事本第一列 {private static Scanner in;private static String path = 读取记事本第一列.class.getResource("").getPath();public static void main(String[] args) throws IOException {// TODO Auto-generated method stubtry {in = new Scanner(new FileReader(path + "20101020.txt"));} catch (FileNotFoundException e1) {e1.printStackTrace();}while (in.hasNextLine()){String first_column = in.next(); //只读取第一列System.out.println(first_column); java.io.FileWriter fw = new java.io.FileWriter("F:/wangzq_document/project/file_operational/phone.txt", true); java.io.PrintWriter pw = new java.io.PrintWriter(fw); pw.println(first_column+"\n"); pw.close(); fw.close(); in.next();in.next();in.next();in.next();}}}