public static void main(String[] args) throws FileNotFoundException { try { File f = new File("Files\\cities.txt"); Scanner input = new Scanner(f); String text; while(input.hasNextLine()) { text = input.nextLine(); process(text); } } catch (FileNotFoundException ex) { System.out.println(ex.getMessage()); } } public static void process(String text) { String name = null; int id; Scanner code = new Scanner(System.in); System.out.println("enter the postcode"); id = code.nextInt(); Scanner data = new Scanner(text); if(code.equals(0))System.out.println(name); name = data.next(); id = data.nextInt(); while(data.hasNextDouble()) { } System.out.println(name+ " "); } }
int
nextDouble
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)