The hashCode() method of java.text.MessageFormat class is used to get hashcode for this message format object.
Syntax:
public int hashCode()
Parameter: This method does not take any argument as a parameter.
Return Value: This method returns the hash code for this message format object.
Below are the examples to illustrate the hashCode() method:
Example 1:
Java
// Java program to demonstrate// hashCode() methodimport java.text.*;import java.util.*;import java.io.*;public class GFG { public static void main(String[] argv) { // creating and initializing MessageFormat MessageFormat mf = new MessageFormat("{0, number, #}, {2, date, #.#}, {4, time}"); // getting hash code // for this MessageFormat Object // using hashCode() method int hash = mf.hashCode(); // display the result System.out.println("Hashcode is : " + hash); }} |
Hashcode is : 1408
Example 2:
Java
// Java program to demonstrate// hashCode() methodimport java.text.*;import java.util.*;import java.io.*;public class GFG { public static void main(String[] argv) { // creating and initializing MessageFormat MessageFormat mf = new MessageFormat("{0, number, #}, {4, time}"); // getting hash code // for this MessageFormat Object // using hashCode() method int hash = mf.hashCode(); // display the result System.out.println("Hashcode is : " + hash); }} |
Hashcode is : 44
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/MessageFormat.html#hashCode–

… [Trackback]
[…] Read More here to that Topic: geeksforgeeks.org/messageformat-hashcode-method-in-java-with-example-2/ […]
… [Trackback]
[…] Find More here to that Topic: geeksforgeeks.org/messageformat-hashcode-method-in-java-with-example-2/ […]
… [Trackback]
[…] Find More here on that Topic: geeksforgeeks.org/messageformat-hashcode-method-in-java-with-example-2/ […]
… [Trackback]
[…] There you will find 77931 additional Info on that Topic: geeksforgeeks.org/messageformat-hashcode-method-in-java-with-example-2/ […]
… [Trackback]
[…] Find More on that Topic: geeksforgeeks.org/messageformat-hashcode-method-in-java-with-example-2/ […]
… [Trackback]
[…] There you can find 77390 more Info on that Topic: geeksforgeeks.org/messageformat-hashcode-method-in-java-with-example-2/ […]