Formatter hashCode() in Java

hashCode(): This method is available in java.util.Formatter 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

import java.util.Formatter;
import java.util.Locale;

public class FormatterhashCode {
    public static void main(String[] args) {

        StringBuffer buffer = new StringBuffer();

        @SuppressWarnings("resource")
        Formatter formatter = new Formatter(buffer, Locale.UK);

        System.out.println(formatter.hashCode());

    }
}

Output:

509886383


No comments:

Post a Comment