Java Date Time - ZoneId equals(Object obj) example

ZoneId equals(Object obj) checks if this time-zone ID is equal to another time-zone ID. The comparison is based on the ID.


equals has the following syntax.

public boolean equals(Object obj)


The following example shows how to use equals.

import java.time.ZoneId;

public class Main {
  public static void main(String[] args) {
    ZoneId z = ZoneId.systemDefault();

The code above generates the following result.