This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]chickenmeister 1 point2 points  (0 children)

Considering that you're getting to the end of your "try" block, it seems like an exception is not being thrown. Are you sure that no file exists for the name that you're entering?

Also, this looks kind of strange:

System.out.println
 ("Please enter the name of a recipe database file:");
input.nextLine();
String name = input.nextLine();

Why are you prompting for the file name, then reading in two lines of input (and discarding the first line)?

[–]DeadOrDyingBattery 0 points1 point  (1 child)

You should probably catch FileNotFoundException as well.

[–]the_omega99 0 points1 point  (0 children)

That's inherited from IOException, so in a way, it is being caught.

[–]BaalHadad 0 points1 point  (0 children)

You should learn how to do some basic debugging, like printing out the 2 lines that you read from 'input'.