Java Field.hashCode()

Syntax

Field.hashCode() has the following syntax.

public int hashCode()

Example

In the following code shows how to use Field.hashCode() method.


import java.lang.reflect.Field;
/*www.jav  a2s.com*/
public class Main {
  public static void main(String args[]) throws Exception{
      Class c = Class.forName("java.awt.Dimension");

      Field fields[] = c.getFields();
      for (int i = 0; i < fields.length; i++) {
        System.out.println(fields[i].hashCode());
      }
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang.reflect »




Array
Constructor
Field
Method
Modifier
ParameterizedType
TypeVariable