Java Swing Tutorial - Java Color.equals(Object obj)








Syntax

Color.equals(Object obj) has the following syntax.

public boolean equals(Object obj)

Example

In the following code shows how to use Color.equals(Object obj) method.


import java.awt.Color;
public class Main {
  public static void main(String[] a) {
    Color myBlack = new Color(0, 0, 0); // Color black
    Color myWhite = new Color(255, 255, 255); // Color white
    System.out.println(myBlack.equals(myWhite));
  }
}

The code above generates the following result.