The values() method of TimeUnit Class returns an array containing the constants of this enum type, in the order they are declared. In short, this method is used to get the Enum Constants of TimeUnit Class.
public static TimeUnit values()
Return Value: This method returns an array containing the constants of this enum type, in the order they are declared
Below program illustrate the TimeUnit values() method:
The Enum constants of TimeUnit Class using TimeUnit.values() are: NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
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.