Share via


Integer Constructors

Definition

Overloads

Integer(Int32)

Constructs a newly allocated Integer object that represents the specified int value.

Integer(String)

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.

Integer(Int32)

Constructs a newly allocated Integer object that represents the specified int value.

[Android.Runtime.Register(".ctor", "(I)V", "")]
public Integer (int value);
[<Android.Runtime.Register(".ctor", "(I)V", "")>]
new Java.Lang.Integer : int -> Java.Lang.Integer

Parameters

value
Int32

the value to be represented by the Integer object.

Attributes

Remarks

Constructs a newly allocated Integer object that represents the specified int value.

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

Java documentation for java.lang.Integer.Integer(int).

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

Integer(String)

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.

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

Parameters

s
String

the String to be converted to an Integer.

Attributes

Exceptions

if string cannot be parsed as an integer value.

Remarks

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter. The string is converted to an int value in exactly the manner used by the parseInt method for radix 10.

This member is deprecated. It is rarely appropriate to use this constructor. Use #parseInt(String) to convert a string to a int primitive, or use #valueOf(String) to convert a string to an Integer object.

Java documentation for java.lang.Integer.Integer(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