70
Java Float equals() method
The equals() method of Float class returns a Boolean value corresponding to this Float Object by simply comparing the Float object with the given float object method argument.
Syntax:
Parameters:
The parameter obj is passed which is an object compared with other object.
Return Value:
This method returns the Boolean value of the argument.
- Returns true, if the objects are same.
- Return false, if the objects are not same.
Example 1
Output:
Enter password 20.09 Password matched
Example 2
Output:
Enter marks in Maths 98 Enter marks in English 90 Enter marks in Hindi 90 Your CGPA is 9.0 Congratulation! You passed with A+ grade
Example 3
Output:
If there are 4 apples.You take away 2 apples.How many do you have in hands? 1. 1 apple 2. 2 apples 3. 3apple Enter your option. 2 Right answer!
Next TopicJava Float