Java TimeUnit.valueOf(String name)

Syntax

TimeUnit.valueOf(String name) has the following syntax.

public static TimeUnit valueOf(String name)

Example

In the following code shows how to use TimeUnit.valueOf(String name) method.


//from  w ww  .jav  a 2  s .co  m
import java.util.concurrent.TimeUnit;

public class Main {
  public static void main(String[] args)throws Exception {
    TimeUnit timeUnit = TimeUnit.valueOf(TimeUnit.DAYS.name());
    System.out.println(timeUnit);
  }
}




















Home »
  Java Tutorial »
    java.util.concurrent »




ArrayBlockingQueue
BlockingDeque
CountDownLatch
CyclicBarrier
TimeUnit