Java Number longValue() Method

The longValue() is a method of Java Number Class which returns the value of the specified number object as long equivalent.

Syntax:

Following is the declaration of longValue() method:

Parameter:

DataTypeParameterDescription
NANAThis method does not accept 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.0 and above

Example 1

Test it Now

Output:

Value is = 261433

Example 2

Test it Now

Output:

85
4101
59
52134

Example 3

Test it Now

Output:

Output Number as long: 298689
Output Float as long: -98723888





Latest Courses