Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Carey Brown

Saloon Keeper
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
Forum Moderator
Carey Brown currently moderates these forums:
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

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.
3 hours ago
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)"

Changed to "CDC-1.0/Foundation (jdk-9.0.4)"

But... this still isn't pointing at jdk-10, but seeing as how my code isn't exactly "10" code, this seems to work.

I'd still like to know where the "10" version of this is.
1 day ago
My platform is Windows 10

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 far so good...

Downloaded and installed Eclipse 4.7.3 for Java-10
Run Eclipse
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.

-- All help appreciated folks

(from "the bleeding edge")
2 days ago
Have you tried it?
4 days ago
Then it's just like reading any text file.
5 days ago
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?
5 days ago
This is a classic error and is why writing this is a no-no.
You meant to say
but as you found out, if you mistakenly leave out one of the '=' then the behavior changes entirely.
You should instead use
5 days ago
To compare all possible combinations of pts rows you'll need to revise this loop. Note that distance(A,B) is the same as distance(B,A), so don't test the same combination of rows.
5 days ago
You can do away with all your temp variables, pts[n] returns an array of three elements (x,y,z). So, you'd end up with
Like wise for the code in your loop.
5 days ago
You are correct, but if letterInput = a then charAt(1) will throw an exception.
6 days ago
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.
6 days ago
Line 93
You should stick with using scan.nextLine() and stay away from accessing 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

6 days ago
'i' goes from 1 to rows-1. The pts array has rows 0 to rows-1. On line 31 you are adding 1 to the row so that would be 2 to rows. The index must be less than 'rows' so you exceed the limit.
6 days ago
Please post your modified code (with indents cleaned up).
6 days ago
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.
6 days ago