Home » Java Integer longValue() method with Examples

Java Integer longValue() method with Examples

by Online Tutorials Library

Java Integer longValue() Method

The longValue() method is an instance method of Long class under java.lang package. This method returns the value of the specified long object as long equivalent. The longValue() method were inherited from the Number Class.

Syntax:

Following is the declaration of longValue() method:

Parameter:

DataType Parameter Description
NA NA This method does not accepts any parameter.

Returns:

The longValue() method returns the numeric value represented by this object after conversion to type long.

Exceptions:

NA

Compatibility Version:

Java 1.2 and above

Example 1

Test it Now

Output:

Value is = 121  

Example 2

Output:

Enter The Desired Integer Value: 58648  Long Value is: 58648  

Example 3

Test it Now

Output:

Value of l1 as long is: 298689  The Value of l2 as long is: -98723886  

You may also like