View Single Post
  #8 (permalink)  
Old 12-02-2007, 01:22 AM
staykovmarin staykovmarin is offline
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
You are reading it line by line, and setting the country variable to whatever line you have. You should put it in an array, or an ArrayList, then compare the contents of the file, with the input. Something like this:
Code:
BufferedReader rd = new BufferedReader(new FileReader("test.txt")); String country; ArrayList<String> file = new ArrayList<String>(); while ((country = rd.readLine()) != null) { file.add(country); } for (String s : file) { if (s.equals(keyboard.nextLine())) { System.out.println("i know of this contry"); }else { System.out.println("I dont know thic contry"); } }

Last edited by staykovmarin : 12-02-2007 at 01:24 AM.
Reply With Quote