SHARE
TWEET

Untitled

a guest Jun 25th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void readDictionary() throws IOException {
  2.     try {
  3.     File file = new File("English.txt");
  4.  
  5.     Scanner input = new Scanner(file);
  6.  
  7.  
  8.     int count = 0;
  9.     while (input.hasNext()) {
  10.       String word  = input.next();
  11.       System.out.println(word);
  12.       count = count + 1;
  13.                             }
  14.     System.out.println("number of words: " + count);
  15.     }
  16.     catch (Exception e) {
  17.         System.out.println("couldn't find file");
  18.         // TODO: handle exception
  19.     }
  20.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top