Float is an object, float is a variable. And how to a float can assign with a Float. Thank you!
Float F = new Float(3);
float f = F;
Float is an object, float is a variable. And how to a float can assign with a Float. Thank you!
Float F = new Float(3);
float f = F;
That's called autoboxing/unboxing. It's a Java feature which allows implicit conversions between primitive types and their corresponding wrapper classes.
Autoboxing is when, like in your snippet, a primitive is wrapped into an object. Unboxing, viceversa, is the opposite way.
What happens under the hood is something like:
float f = 10.0f;
Float fo = new Float(f); // autoboxing
float f2 = fo.floatValue(); // unboxing
The F object of type Float is automatically unboxed. What you have in your f variable isn't F but F.floatValue().