Partager via


Float Constructors

Definition

Overloads

Float(Double)

Constructs a newly allocated Float object that represents the argument converted to type float.

Float(Single)

Constructs a newly allocated Float object that represents the primitive float argument.

Float(String)

Constructs a newly allocated Float object that represents the floating-point value of type float represented by the string.

Float(Double)

Constructs a newly allocated Float object that represents the argument converted to type float.

[Android.Runtime.Register(".ctor", "(D)V", "")]
public Float (double value);
[<Android.Runtime.Register(".ctor", "(D)V", "")>]
new Java.Lang.Float : double -> Java.Lang.Float

Parameters

value
Double

the value to be represented by the Float.

Attributes

Remarks

Constructs a newly allocated Float object that represents the argument converted to type float.

This member is deprecated. It is rarely appropriate to use this constructor. Instead, use the static factory method #valueOf(float) method as follows: Float.valueOf((float)value).

Java documentation for java.lang.Float.Float(double).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Float(Single)

Constructs a newly allocated Float object that represents the primitive float argument.

[Android.Runtime.Register(".ctor", "(F)V", "")]
public Float (float value);
[<Android.Runtime.Register(".ctor", "(F)V", "")>]
new Java.Lang.Float : single -> Java.Lang.Float

Parameters

value
Single

the value to be represented by the Float.

Attributes

Remarks

Constructs a newly allocated Float object that represents the primitive float argument.

This member is deprecated. It is rarely appropriate to use this constructor. The static factory #valueOf(float) is generally a better choice, as it is likely to yield significantly better space and time performance.

Java documentation for java.lang.Float.Float(float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Float(String)

Constructs a newly allocated Float object that represents the floating-point value of type float represented by the string.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public Float (string s);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")>]
new Java.Lang.Float : string -> Java.Lang.Float

Parameters

s
String

a string to be converted to a Float.

Attributes

Exceptions

if string can not be parsed as a float value.

Remarks

Constructs a newly allocated Float object that represents the floating-point value of type float represented by the string. The string is converted to a float value as if by the valueOf method.

This member is deprecated. It is rarely appropriate to use this constructor. Use #parseFloat(String) to convert a string to a float primitive, or use #valueOf(String) to convert a string to a Float object.

Java documentation for java.lang.Float.Float(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to