Campbell Ritchie

+ Follow
since Oct 13, 2005
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Campbell Ritchie

Agree, but if the exam is geared to Java8, the original version is, as you say, correct for Java8.

Interesting question
You deserve the cow, Piet, for noticing the different behaviour in different versions; I installed Java8u202 and it took slightly over 40″ to run.

$ java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
$ javac -version
javac 1.8.0_202
java WhaleDataCalculator

Tasks completed in: 40.864 seconds

Please look here and check whether I have linked to the correct book. I can't find anything for page 369, so this looks like something new.

Carey Brown wrote:I'm having a bit of a hard time inferring your intent.  . . .

. . . and the poor naming doesn't help. You are calling a List array1, which is a good way to confuse yourself.
8 hours ago
Please show us the files; people are reluctant to download something from an unfamiliar location.
8 hours ago
Welcome to the Ranch

That looks like s kind of csv (=comma‑separated value) file, but using the vertical bar/pipe character as a delimiter. If you look through this FAQ, you will find programs for reading csv files.
If you have to do this all by hand as a class exercise, please start by turning your computer off and writing down on paper how you think you would read that file. Then write down how you would record the positions against the years.
It is worth having confirmation that every line in the file will have exactly six vertical bars/pipes.
8 hours ago
Yes. The new value of the variable incremented by x++ is visible immediately after that expression. But code using more than one ++ or -- operator per statement is bad code which should only be seen in cert exams
9 hours ago

Vaibhav R Ajmera wrote:Passed . . . with 91%. . . .

Well done

I can't remember which number (808/803/809) means what, but please go here (or here) and edit the posts to add your name.
9 hours ago
Welcome to the Ranch

Why have you got static variables in the first place?
12 hours ago
Please don't watch the top video on the Bank of England website.
15 hours ago
That's a pleasure Remember other people helped you too.
Fortunately it is only a concept.

The back ground, Bletchley Park, shows how sometimes good work is done in really bad buildings.
15 hours ago
Please call x++ and x-- postfix operators, not post‑unary.
By the time you reach line 4, the new value of m is visible. That is 8, 7, 6.
1 day ago

Javier Gonzalez wrote:. . . why the post increment doesn´t increment to get 12345?

Have a look at this FAQ, and see whether that helps you. If not, remember there are two values:-
  • 1: The value of i, which is increased by 1, and
  • 2: The value of i++, which is the same as the old value of i.
  • What you are doing in the λ inside the iterate() call is to take the old value and apply it to its variable again. So you are resetting the variable to its original value, 1. Everyy time you execute i -> i++, you are resetting i to 1; you don't see the new value of i until after the plae where the ++ operation happens.So each
    Moving discussion as not a “beginning” topic.
    1 day ago