Java BigDecimal hashCode() method

The hashCode() method of java BigDecimal class is used to obtain the hash code of a BigDecimal Value.

Note: Two BigDecimal objects that are numerically equal but differ in scale (like 2.0 and 2.00) will generally not have the same hash code.

Syntax:

Parameter:

No

Exception:

No

Returns:

It returns hash Code of BigDecimal.

Example 1

Test it Now

Output:

Returned hash code value is =  3565

Example 2

Test it Now

Output:

Returned hash code value is =  -3565

Example 3

Test it Now

Output:

Returned hash code value is =  511501

Example 4

Test it Now

Output:

Returned hash code value is =  5115002

Next TopicJava BigDecimal




Latest Courses