hashCode(): This method is available in java.util.Date class of Java.
Syntax:
int java.util.Date.hashCode()
This method returns a hash code value for this object.
Note: The result is the exclusive OR of the two halves of the primitive long value returned by the Date.getTime method.
Parameters: NA
Returns: a hash code value for this object.
Exceptions: NA
Approach
Java
import java.util.Date;public class DatehashCode {public static void main(String[] args) {Date date = new Date();System.out.println(date.hashCode());}}
Output:
-1426007142
No comments:
Post a Comment