InputStreamReader reader = new InputStreamReader(System.in);  BufferedReader buf_in = new BufferedReader (reader);
	public static void main(String[] args) {			if(args.length!=1)		{			System.out.println("Usage:");			System.out.println("FileBuilder <newfile>");			System.out.println();			return;		}				filename = args[0];				int id=0;				recentQuestions = new Vector();		checkAndBackup();				FileWriter fileout=null;		try {			fileout = new FileWriter(filename);		} catch (IOException e1) {			System.err.println(e1.getMessage());			e1.printStackTrace();		}		BufferedWriter out = new BufferedWriter(fileout);		String tmp=null;				try {			out.write("<quiz>\n");		} catch (IOException e3) {			e3.printStackTrace();		}				if(recentQuestions.size()>0)		{			for(int i=0; i<recentQuestions.size(); i++)			{				QuizQuestion theQuestion = (QuizQuestion) recentQuestions.elementAt(i);				String question="\t<question id=\""+theQuestion.getId()+								"\" text=\""+theQuestion.getQuestion()+"\" points=\""+								theQuestion.getPoints()+"\">\n";							try {					out.write(question);				} catch (IOException e2) {					e2.printStackTrace();				}								for(int j=0; j < theQuestion.getAnswers().size(); j++)				{					String answer="\t\t<answer";					if(theQuestion.getCorrectAnswer()==j)					{						answer+=" correct=\"true\"";					}					answer=answer+">"+(String) theQuestion.getAnswers().elementAt(j)+"</answer>\n";										try {						out.write(answer);					} catch (IOException e4) {						e4.printStackTrace();					}				}								try {					out.write("\t</question>\n");				} catch (IOException e4) {					e4.printStackTrace();				}			}		}		do {			System.out.print("Points for this question: ");			String question=null;			String answer=null;			String points=null;						// We need an InputStreamReader for reading user input			InputStreamReader reader = new InputStreamReader(System.in);			// Wrap the reader with a buffered reader.			BufferedReader buf_in = new BufferedReader (reader);						try {				tmp = buf_in.readLine();			} catch (IOException e) {				System.err.println(e.getMessage());				e.printStackTrace();			}						points = tmp;						System.out.print("Enter question: ");			try {				tmp = buf_in.readLine();			} catch (IOException e) {				System.err.println("Client IOException in SimpleClient.sendMessage()");				System.err.println(e.getMessage());				e.printStackTrace();			}			question="\t<question id=\""+id+"\" text=\""+tmp+"\" points=\""+points+"\">";						try {				out.write(question+"\n");			} catch (IOException e2) {				System.err.println(e2.getMessage());				e2.printStackTrace();			}			System.out.println();			System.out.println("Please enter the correct solution first!");			for(int i=0; i<4; i++)			{				System.out.print("Answer #"+(i+1)+": ");				try {					tmp = buf_in.readLine();				} catch (IOException e) {					System.err.println("Client IOException in SimpleClient.sendMessage()");					System.err.println(e.getMessage());					e.printStackTrace();				}								if(i==0)				{					answer="\t\t<answer correct=\"true\">"+tmp+"</answer>\n";				}				else				{					answer="\t\t<answer>"+tmp+"</answer>\n";				}								try {					out.write(answer);				} catch (IOException e2) {					System.err.println(e2.getMessage());					e2.printStackTrace();				}			}						try {				out.write("\t</question>\n");			} catch (IOException e2) {				System.err.println(e2.getMessage());				e2.printStackTrace();			}						id+=1;						System.out.print("More questions? [y/n] ");			try {				tmp = buf_in.readLine();			} catch (IOException e) {				System.err.println("Client IOException in SimpleClient.sendMessage()");				System.err.println(e.getMessage());				e.printStackTrace();			}								} while(tmp.equals("y"));				try {			out.write("</quiz>\n");		} catch (IOException e3) {			e3.printStackTrace();		}				try {			out.close();		} catch (IOException e) {			System.err.println(e.getMessage());			e.printStackTrace();		}			System.out.println();			}