This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Dear Kaydell Leavitt: Can I ask your development system?
It compiled under my development system, Eclipse 3.2.2 for Mac OS X, running java 1.5.0_07. Then, when I went back for a second-look, I could have sworn that I was getting an exception. And when I went back to see what kind of exception, the code started working.
I'm consistently getting an output of "10" now.
[Edited to delete inconsistencies] [ June 11, 2007: Message edited by: Kaydell Leavitt ]
Joined: Feb 07, 2005
I tried it with Eclipse under Windows, and it also compiled and ran. I think the issue is that Eclipse doesn't use the pure Java compiler from Sun.
This looks like a tricky language corner issue, as Sun's compiler and the Eclipse compiler disagree on what's correct. I'm going to move this to our Java in General (Intermediate) forum and call in the big guns.
Hm, now I can't really comment without looking egotistical. But EFH asked me to comment, so here I am. I'm pleased he has such a high opinion of me, but I'm pretty sure there are several other regular posters who are at least as qualified. Including (or especially) Dr. Friedman-Hill himself. Anyway...
Thus far, I don't see any reason for the error thrown by Sun's compiler. I would say it looks like a bug. I don't see any good justification for it - it looks like Sun screwed up, period. I will continue to look into it, but so far, I'm not seeing any justification for the behavior of Sun's compiler here.
If anyone else reading this has any further insight, please share it. [ June 12, 2007: Message edited by: Jim Yingst ]