public class AddressBook { private String[] firstNames = new String[1000]; int firstNameCount = 0; private String [] lastNames = new String[1000]; int lastNameCount = 0; private String[] addresses = new String[1000]; int addressCount = 0; public void readFromFile(String filename) throws Exception { Scanner sc = new Scanner (new File(filename)); sc.useDelimiter(","); int bitCount = 0; while(sc.hasNext()) { String bit = sc.next(); switch(bitCount++) { case 0: fistNames[firstNameCount++] = bit; break; case 1: lastNames[lastNameCount++] = bit; case 2: addresses[addressCount++] = bit; } if (bitCount > 2) bitCount = 0; }
3 wanted to know worst problems with this implementation, in your opinion.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)