Hi,
Im trying to catch a file not found exception so that my program can do something when it occurs, but I keep getting "FileNotFound exception is never thrown in body of corresponding try statement."
I am using a try catch block in the following piece of code to attempt this.
String[] goChar = new String[6];
public BQ() {
initComponents();
try {
Scanner charIn = new Scanner("character.txt");
int count = 0;
while (charIn.hasNext())
{
goChar[count] = charIn.next();
count ++;
}
} catch(FileNotFoundException e) {
JOptionPane.showMessageDialog(null,"Welcome to Bodacious Quest, where questing\n "
+ "is the name of the game. To begin,\n we need to get some information from you,\n "
+ "the bodacious player. Please complete the\n following screens to set up your character." ,null, JOptionPane.INFORMATION_MESSAGE);
setRace();
}
Any assistance would be greatly appreciated. Thanks!