Typically a file ending in '.sql' is a plain text database program written in SQL. So, are you wanting to read in the plain text of the file, or are you trying to run the file as a database program and capture its output?
You have a potential problem with these lines
If the user just presses Enter with no characters then the charAt(0) will throw an exception. Likewise, if only a single character is entered the charAt(1) will throw an exception. You'll want to check that letterInput.length() == 2 to take some preventative steps. Also, you may want to change the prompt to let the user know not to put a space between the two characters.
You should stick with using scan.nextLine() and stay away from accessing System.in by two different means.
An ASCII 'a' has a numeric value of 97 (decimal). 'f' is 102. A space is 32. So therefore your code would translate to
On line 1, choiceOne can never be greater-or-equal to 97 AND at the same time be less-than-or-equal to 32.
To see if your chars ARE NOT in the range of 'a' through 'f'
Your println("\f"); is also a problem. If you want to output a blank line use
One often used approach where user input is required is to put the validation check and loop inside a method. Something like
Then in the main body of your code you can call it like:
And remove all your validation from your main body. Much cleaner.