Tony Docherty wrote:With regard to that article: It is misleading to state that the pool stores values from -128 to 127.
The JLS states that auto-boxing of numbers in the range of -128 to 127 will result in the same object but goes on to say "Less memory-limited implementations might, for example, cache all char and short values, as well as int and long values in the range of -32K to +32K.". Therefore you should not rely on the fact that numbers outside the range of -128 to 127 will be different objects.
Also, you can get the cached Integer objects if you use Integer.valueOf(x) ie:
i1 and i1 are not the same objects whereas i3 and i4 are the same objects.
Russell Bateman wrote:I know this is a pretty beginning Java question and if I knew what to call it, I could simply Google for the answer. If I have a class A that's going to be a "subset" of other classes B, C and probably others...
How do I code class B (and C, etc.) such that...
(Please answer the question in the comment above.)
Profuse thanks for taking pity on an old C programmer still too often struggling with the concepts.
Russ
Prasanna Raman wrote:
The error here "reference to varArgs is ambiguous". Why does the error show up here but not in the other code? Maybe because here both methods use varargs and in the other code, only one uses it?
Aravindh Vin wrote:Similar problem.. What is the output of the below code and explain why?
Jay Mize wrote:Hey Phil, won't I have to force the while loop (randomLowUp > 90 && randomLowUp < 97) to start by initializing randomLowUp to a value like 92? Thanks
Jay Mize wrote:Won't that create an array? Is there anyway to make Java generate a number between two set of range? Like generating a mumber from 65 to 90 or 97 to 122.
Jay Orsaw wrote:Hello all! I've been doing Java for awhile, but I've never really needed to use the args String, so I'm curious why would you?
I was reading this http://www.javaranch.com/drive/command.html
when I got into the Q, and they kind of spoke about it... It seems like it has to do with the command line though? Would we do args like that normally?