Alright new assignment is to read a bunch of strings from a file then ask the user which word he wants to find, then search the words in the file to see how many times the word appears.


Rawr
Rawr
John
John
Rawr
rawr

Ex: Search John
ouput: 2

my idea was to read the strings in from the file, then push them into a vector then search from there. Basically im just looking for input on what i have so far, and If there is a easier way to do it.

Code:
import java.io.*;
import java.util.Scanner;
import java.util.Vector;


public class LabThree {
    public static void main(String[] args) {
        try {
			System.out.print("Enter the word you wish to search for: ");
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String word = null;
			word = br.readLine();
			Vector<String> T = new Vector<String>();
            Scanner scanner = new Scanner(new File("input.txt"));
            while(scanner.hasNext()) {
                String s = scanner.next();
				T.add(s);
			}
            scanner.close();
        }
        catch(FileNotFoundException e) {}
		catch (IOException e) {}
    }
}