is the same as
Notice that line 2 has a semi-colon all by itself, this is an empty statement which is legal. Sometimes you want this but most of the time it is a mistake. For those times that you actually want it a comment to that affect is a good idea. Note that the for() loop then ends with line 2.
On lines 4 and 5 you have a set of braces not associated with a loop, method, or conditional construct. This is considered a "code block" and is legal. Often times this appears where you need to control the scope of a variable. Because of line 2, this block is not tied to the for() loop.
I've installed Java-10 without any problems.
Edited my JAVA_HOME to point to new jdk-10
My Path env variable uses %JAVA_HOME%\bin
Running: java -version
java version "10" 2018-03-20
...so far so good...
Downloaded and installed Eclipse 4.7.3 for Java-10
Installed Subclipse (SVN)
Pointed to working directory
All my projects show up with their SVN time stamps
...good so far...
Added jdk-10 to list of installed JREs and made it the default.
When to change Java>Compiler>Compliance level to 10 but that is not an option. The highest it goes is 9.
Then went to one of my projects that uses an ANT build
Right clicked on build.xml > Run as > External tool configurations > JRE :: I selected "run in the same JRE as the workspace.
...and tried to run build.xml I get this:
My JAVA_HOME is correct, so that's not the problem.
I don't know what's telling it that the JDK is 1.8.0_144 or how to change it.
...going back to External tool configurations > JRE :: I tried "Execution environment" but "10" is not an option and it is currently at CDC-1.0/Foundation-1.0 (jre1.8.0_144)"
Tried "Separate JRE" :: select my jdk-10 JRE, but when I try to run build.xml I get
JRE version less than 1.8 is not supported
I tried googling the issue but wasn't able to find anything useful.
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.