The now(Clock clock) method of the LocalTime class in Java is used to get the current time from the specified clock.
public static LocalTime now( Clock clock)
Parameters: This method accepts clock as parameter which represents the clock to use.
Return value: This method returns the current time.
Below programs illustrate the now(Clock clock) method of LocalTime in Java:
Above two examples are taken to show the variance in result for same program according to time progression.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.