Java Swing Tutorial - Java Color.hashCode()








Syntax

Color.hashCode() has the following syntax.

public int hashCode()

Example

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

import java.awt.Color;
/*  w  w w . jav  a 2s  . c  om*/
public class Main {
  public static void main(String[] args) {
    Color myColor = Color.RED;          

    System.out.println(myColor.hashCode());
    
  }
}

The code above generates the following result.