Java Date Time - OffsetTime equals(Object obj) example








OffsetTime equals(Object obj) checks if this time is equal to another time.

Syntax

equals has the following syntax.

public boolean equals(Object obj)

Example

The following example shows how to use equals.

import java.time.OffsetTime;
//from www  . j  a v  a 2s. c  o m
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();

    System.out.println(m.equals(OffsetTime.now()));

  }
}

The code above generates the following result.