Two new Scanner objects - file object and a line object Joe Doe,35,45.78,true try { Scanner scFile = new Scanner(new File("myFile.txt")); int size = 0; while (scFile.hasNext()) { String line = scFile.nextLine(); Scanner scLine = new Scanner(line).useDelimiter(","); String name = scLine(next); int age = scLine.nextInt(); double price = scLine.nextDouble(); boolean flag = scLine.nextBoolean(); template[size] = new Object(name,age,price,flag); size++; } // end while } catch (FileNotFoundException ex) { JOptionPane.showMessageDialog(null, "Error! File not found"); System.out.println(ex.getMessage); System.exit(0); } // end catch