Java Double equals() method

The equals() method of Java Double class compares this Double object against the specified Double object.

The method returns true, if the argument is not null.

Assuming d1 and d2 are the two instances of class Double, the value of d1.equals(d2) will be true if

Also returns the value true.

Overrides:

The equals() method of class Double overrides the equals() method in class Object.

Syntax

Parameters

obj - this is the object to compare with.

Return value

The equals() method will return true if objects are same, otherwise returns false.

Example 1

Output:

Enter your bank accountNo.
12345.89
Your accountNo has matched.Now you can proceed with your transaction

Example 2

Output:

Q. If an ant has 4 legs.How many legs do 8 ants will have ?
1.8 Legs 	  2.32 legs 	  3.65legs
Enter your option 
2
Your answer is correct!

Example 3

Output:

Enter your name.
Himanshu
Enter your old password.
768.90
Enter your new password
panda@123
Himanshu your password has successfully changed to panda@123