Advertisement
gdog2u

fillArrays

Mar 18th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. public static void fillArrays() throws IOException{
  2.         String temp;
  3.         String[] files = {KBowlCats.ARTS, KBowlCats.CAPITALS, KBowlCats.ENGLISH, KBowlCats.GEOGRAPHY, KBowlCats.GLOBAL_TECH, KBowlCats.GOVERNMENT, KBowlCats.HEALTH, KBowlCats.HISTORY, KBowlCats.ITF, KBowlCats.LITERATURE, KBowlCats.MATH, KBowlCats.OHIO_HISTORY, KBowlCats.OUR_US, KBowlCats.POTPURRI, KBowlCats.SAFETY, KBowlCats.SCIENCE, KBowlCats.SPELLING, KBowlCats.SPORTS, KBowlCats.VIP, KBowlCats.WORK_LEADERSHIP}; //This array holds strings that contain file locations.
  4.         String[][] arrays = {KBowlCats.arts, KBowlCats.capitals, KBowlCats.english, KBowlCats.geography, KBowlCats.globalTech, KBowlCats.government, KBowlCats.health, KBowlCats.history, KBowlCats.itf, KBowlCats.literature, KBowlCats.math, KBowlCats.ohioHistory, KBowlCats.ourUS, KBowlCats.potpurri, KBowlCats.safety, KBowlCats.science, KBowlCats.spelling, KBowlCats.sports, KBowlCats.vip, KBowlCats.workLeadership}; //This array holds arrays to keep all the lines of text from the files.
  5.         for(int x = 0; x < files.length; x++){
  6.             try {
  7.                 BufferedReader br = new BufferedReader(new FileReader(files[x]));
  8.                 for(int i = 0; i < 200 && (temp = br.readLine()) != null; i++){
  9.                     arrays[x][i] = temp;
  10.                 }
  11.             } catch (FileNotFoundException e) {
  12.                 System.err.println("Error:" + e);
  13.             }
  14.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement