Java.lang.Float.hashCode() Method

Advertisements


Description

The java.lang.Float.hashCode() method returns a hash code for this Float object.

Declaration

Following is the declaration for java.lang.Float.hashCode() method

public int hashCode()

Parameters

  • NA

Return Value

This method returns a hash code value for this object.

Exception

  • NA

Example

The following example shows the usage of java.lang.Float.hashCode() method.

package com.tutorialspoint;

import java.lang.*;

public class FloatDemo {

   public static void main(String[] args) {

     Float f = new Float("25.57f");
    
     // returns a hash code value
     int retval = f.hashCode();
     System.out.println("Value = " + retval);
   }
}   

Let us compile and run the above program, this will produce the following result:

Value = 1103925084



Advertisements
Advertisements