Difficulty throwing exceptions
I think I need to throw IOExceptions and FileNotFoundExceptions to get the following program to work. (It doesn't do much at the moment, just set the stage for some file I/O, but I need to throw the exception to keep going.)
However, the following line:
public static void main(String[] args ) throws IOException {
gives me the following error:
'cannot find symbol. symbol: class IOException location: class fileio.main'
What am I doing wrong? is this not how you throw exceptions?
package fileio;
import java.io.File;
import java.util.Scanner;
import java.io.PrintWriter;
/**
*
* @author David Erb
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args ) throws IOException {
File MyFile = new File("fnum1.txt");
Scanner MyScanner = new Scanner(MyFile);
PrintWriter MyWriter = new PrintWriter(MyFile);
}
}

