SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Max Rahder wrote:(Fairly irrelevant story: I once worked on a FORTRAN system where there was a bug that allowed you to pass a literal, like 1, by reference. In that way you could re-assign it to another value. In other words, it allowed you to make (1 .EQ. 2) evaluate to true.)
Paul Clapham wrote:My guess is that for the first run, you were looking at source code which didn't match the compiled class which you ran. Then you changed the source code and recompiled before the second run. This would explain why the second run did what you expected.
To test my theory, change the code back to the version for the first run and recompile it. If my theory is correct, the third run should also do what you expected.
fred rosenberger wrote:i'd verify "Utils.IsTextNode(tNode)" is really returning what you think it is. put in some System.out.println() statements to be sure.
Rahul.p Kumar wrote:Let us say qq = Utils.IsTextNode(tNode) returns boolean. Now qq alone should serve your purpose. Anyway there is no difference between reassigning. So, check for qq, what it is returning, take the opposite meaning.
Erwin Poeze wrote:
This proved that the problem is not caused by Java, but by NetBeans. In the debugger the line (Current Program Counter) jumps inside the if statement (to be exact, it jumps to numVNodes++; directly, skipping the second if statement), but this code is not executed. Adding lines above the first if statement influences the debugger behaviour, so it seems that adding the additional qq variable 'solves' the problem, but it is all visual!
Rahul.p Kumar wrote:
Delete your class file. Probably your class file and java are not in sync. have you added that if line later than rest of lines ? please don't forget to post the final outcome from netbeans forum.
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
There's a city wid manhunt for this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|