public static void main(String[] args) throws Exception{
		Scanner reader=new Scanner(System.in);
		ReadPhrase readPhrase=new ReadPhrase(new File("phrase.txt"));
		File favorite=new File("favorite.txt");
		System.out.println("是否从上次结束开始读取成语Y/N");
		String answer=reader.nextLine();
		if(answer.startsWith("Y")||answer.startsWith("y")){
			CareTaker care=new CareTaker();
			Memento mem=care.getMemento();
			readPhrase.restoreFromMemento(mem);
		}
			String phrase=null;
			while((phrase=readPhrase.readLine())!=null){
				System.out.println(phrase);
				System.out.println("是否将该成语保存到"+favorite.getName()+"Y/N");
				answer=reader.nextLine();
				if(answer.startsWith("Y")||answer.startsWith("y")){
					FileWriter out=new FileWriter(favorite,true);
					out.write(phrase);
					out.write('\n');
					out.flush();
					out.close();
				}
				System.out.println("是否继续读取成语Y/N");
				answer=reader.nextLine();
				if(answer.startsWith("Y")||answer.startsWith("y")){
					continue; //***跳到循环开始处
				}else{
					readPhrase.closeRead();
					CareTaker care=new CareTaker();
					care.saveMemento(readPhrase.createMemento());
					System.exit(0);
				}
			}
			System.out.println("读取完毕！");
	}