Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Everyday in every way, we get a little better.
Jesper Young wrote:What's really strange about this code is that when you call discoverParadox() for the third time, with the same input, it produces a different result... Really strange. I don't see how that happens.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Wouter Oet wrote:It returns the same results using -Xint:
C:\Users\wouter\Desktop\Temp>java Huh
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: true, life: -24
Jesper Young wrote:Wouter, what version of Java are you using on what operating system?
I'm using JDK 1.6.0 update 22 (64-bit) on 64-bit Windows Server 2008 R2 and I'm getting the same output as Bruce showed in his opening post.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Kurt Van Etten wrote:Here's a question for the people who are getting the strange behavior: if you change the for loop in the main method to iterate 4 times instead of 3, do you get something like the output below?
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: false, life: 2
life < 0: false, life: 28
life < 0: false, life: 54
Everyday in every way, we get a little better.
Bruce Coleman wrote:I'm just going to be a manager. Somebody, please take my keyboard.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber wrote:H:\Java>java Huh
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: true, life: -24
H:\Java>java -version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)
Windows XP Professional, version 5.1
Henry Wong wrote:
BTW, like Marc, I am using the client JIT compiler -- while you seem to be using the server JIT compiler. Maybe that's the difference?
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\> java Huh
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: true, life: -24
C:\> java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
C:\> java -server Huh
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: true, life: -24
life < 0: false, life: 2
life < 0: false, life: 28
I'm not sure if I approve of this interruption. But this tiny ad checks out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|