I don't know what's wrong with my code. It keeps on giving me 2 errors saying:
(line with try)
Error 1: llegal start of type
(line at the end of the catch block)
Error 2: <identifier> expected
Here's my code...
What did I do wrong?
-------------------------------
import java.io.*;
import java.util.StringTokenizer;
import java.util.Enumeration;
class pass_one
{
//Read in the file line by line
try
{
BufferedReader fsr = new BufferedReader( new FileReader(input));
String str;
while(( str = fsr.readline()) != null)
{
StringTokenizer st = new StringTokenizer(str);
while(st.hasMoreTokens())
{
String s = st.nextToken();
}
}
fsr.close() //close file
}
catch(IOException e)
{
System.err.println("Error reading file: " +e.toString());
}
}//end class pass_one
(line with try)
Error 1: llegal start of type
(line at the end of the catch block)
Error 2: <identifier> expected
Here's my code...
What did I do wrong?
-------------------------------
import java.io.*;
import java.util.StringTokenizer;
import java.util.Enumeration;
class pass_one
{
//Read in the file line by line
try
{
BufferedReader fsr = new BufferedReader( new FileReader(input));
String str;
while(( str = fsr.readline()) != null)
{
StringTokenizer st = new StringTokenizer(str);
while(st.hasMoreTokens())
{
String s = st.nextToken();
}
}
fsr.close() //close file
}
catch(IOException e)
{
System.err.println("Error reading file: " +e.toString());
}
}//end class pass_one