Float.equals(Object obj) has the following syntax.
public boolean equals(Object obj)
In the following code shows how to use Float.equals(Object obj) method.
public class Main { //www . j a v a 2s . co m public static void main(String[] args) { Float obj1 = new Float("10"); Float obj2 = new Float("10.0"); System.out.print(obj1 + " = " + obj2); System.out.println(" ? " + obj1.equals(obj2)); obj1 = new Float("20"); obj2 = new Float("6.000000"); System.out.print(obj1 + " = " + obj2); System.out.println(" ? " + obj1.equals(obj2)); } }
The code above generates the following result.