"Writing to a text file" not compiling

It is showing 'file not found exception' in the line in which the 'output' object is declared.The file 'scores.txt' is in my current working directory also.I cant get what's the error there.Please help.

Re: "Writing to a text file" not compiling

"If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file."
From the API.
So there's a few possibilities there and, since you have an exists() check which exits if the file exists, the relevant ones are in italics.

Re: "Writing to a text file" not compiling

Well I guess that is the code; the title of the post already indicates "not compiling". I'm guessing that the reference to the file not found exception is not during runtime, but actually during compile time.

Re: "Writing to a text file" not compiling

... and provide the exact error gotten in stead of "something along these lines" :/ If the OP would have specified "unhandled exception type FileNotFoundException" then there would have been no confusion.