equals(Object): This method is available in java.util.Formatter class of Java.
Syntax:
boolean java.lang.Object.equals(Object obj)
This method takes one argument. This method indicates whether some other object is "equal to" this one.
Parameters: One parameter is required for this method.
obj: the reference object with which to compare.
Returns: true if this object is the same as the obj argument; false otherwise.
Approach
Java
import java.util.Formatter;import java.util.Locale;public class Formatterequals {public static void main(String[] args) {StringBuffer buffer = new StringBuffer();@SuppressWarnings("resource")Formatter formatter = new Formatter(buffer, Locale.UK);Formatter formatter2 = new Formatter(buffer, Locale.UK);System.out.println(formatter.equals(formatter2));}}
Output:
false
No comments:
Post a Comment