Float hashCode() method in Java with examples
The hashCode() method method in Float Class is a built-in method in Java that return the hashcode value of this Float object.
Syntax:
public int hashCode()
Parameters: It takes no parameters.
Returns: The function returns a hash code value for this object.
Below is the implementation of hashCode() method:
Example 1:
// Java code to demonstrate // Float hashCode() Method class GFG { public static void main(String[] args) { float d = 118.698f; // creating Float object. Float value = new Float(d); // hashCode() method Float class int output = value.hashCode(); // printing the output System.out.println("Hashcode Value of " + value + " : " + output); } } |
chevron_right
filter_none
Output:
Hashcode Value of 118.698 : 1122854240
Example 2:
// Java code to demonstrate // Float hashCode() Method class GFG { public static void main(String[] args) { int i = -30; // creating Float object. Float value = new Float(i); // hashCode() method Float class int output = value.hashCode(); // printing the output System.out.println("Hashcode Value of " + value + " : " + output); } } |
chevron_right
filter_none
Output:
Hashcode Value of -30.0 : -1041235968
Recommended Posts:
- Java Guava | Floats.indexOf(float[] array, float[] target) method with Examples
- Java Guava | Floats.indexOf(float[] array, float target) method with Examples
- Map hashCode() Method in Java with Examples
- Set hashCode() method in Java with Examples
- AbstractList hashCode() method in Java with Examples
- Date hashCode() method in Java with Examples
- ZonedDateTime hashCode() method in Java with Examples
- Calendar hashCode() Method in Java with Examples
- MonthDay hashCode() method in Java with Examples
- ChronoLocalDateTime hashCode() method in Java with Examples
- ShortBuffer hashCode() Method in Java with Examples
- ChronoPeriod hashCode() method in Java with Examples
- UUID hashCode() Method in Java with Examples
- DecimalFormatSymbols hashCode() method in Java with Examples
- StringWriter hashCode() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



