I'm having problem with displaying first words, for some reaso I can only display words starting with 'S'.
Here is what I have so far:
Expand|Select|Wrap|Line Numbers
- public static void main(String args[])
- {
- try{
- // Open the file that is the first
- // command line parameter
- FileInputStream fstream = new FileInputStream("dictionary.txt");
- // Get the object of DataInputStream
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- String strLine;
- //Read File Line By Line
- while ((strLine = br.readLine()) != null) {
- String[] delims = strLine.split(" ");
- String first = delims[0];
- for(int i = 0; i < delims.length-1; i++ )
- {
- System.out.println(delims[i]);
- }
- }
- //Close the input stream
- in.close();
- }catch (Exception e){//Catch exception if any
- System.err.println("Error: " + e.getMessage());
- }
- }