hashCode(): This method is available in java.lang.Object class of Java.
Syntax:
int java.lang.Object.hashCode()
This method returns a hash code value for the object.
Parameters: NA
Returns: a hash code value for this object.
Exceptions: NA
Approach
Java
public class NumberhashCode {public static void main(String[] args) {Number number = 123;System.out.println(number.hashCode());}}
Output:
123
No comments:
Post a Comment