wrapper « Integer « Java Data Type Q&A





1. Assigning integer value to a Float wrapper in Java    stackoverflow.com

The following works

float a=3;
but the following doesn't:
Float a=3;
Shouldn't 3 be automatically promoted to float (as widening conversions don't require an explicit cast) and then Boxed to Float type ? Is it because ...

2. What exactly does comparing Integers with == do?    stackoverflow.com

EDIT: OK, OK, I misread. I'm not comparing an int to an Integer. Duly noted. My SCJP book says:

When == is used to compare a primitive to a wrapper, ...

3. Properties of Double.NaN and why does Integer wrapper not have an NaN data memeber?    stackoverflow.com

i=Double.NaN
while(i==i)
{
//some code
}
what is the output? Why don't we have a Integer.NaN?

4. Integer Wrapper Substraction    stackoverflow.com

Say we have two Integer objects:

Integer i=100,j=200;
Does (j-i) evaluate to another Integer Wrapper object with value 100?

5. Confused about "==" to compare Integer wrapper objects    forums.oracle.com

I don't think there's anything harmful about studying and memorizing the Java API. But it wouldn't hold any weight with me if I were trying to guage a person's programming ability. Knowing generally what it contains and then being able to use it as a reference is far more important to me. That way, if my company decides to switch/add a ...