For some reason, and I have no idea why. This code doesn't work. I am obviously a newbie to java, and programing in general. But this seems like it would just work. It does so in C++.
public void Read() //Just Reads the File, does not pass anything back { String test[]; int x; try { BufferedReader readout = new BufferedReader(new FileReader("ClientNames.txt")); String names; while ((names = readout.readLine()) != null) { x++; test[x] = names; System.out.print(" " + names + ", "); } readout.close(); } catch (IOException e) {System.out.println("Could Not Read out file"); } }//End of Read
And i get this error.
x variable might not have been initialized. test variable might not have been initialized.
Off to work now, so I wont be able to respond right away. Thanks in advance =)