public class TrafficLight extends Object
| 构造器和说明 |
|---|
TrafficLight()
green light is off on default
|
TrafficLight(boolean isGreen) |
public TrafficLight()
public TrafficLight(boolean isGreen)
isGreen - green light is onpublic void setRed()
public void setGreen()
throws InterruptedException
public void waitGreen()
throws InterruptedException
InterruptedException - if any thread interrupted the current thread before or while
the current thread was waiting for a notification. The
interrupted status of the current thread is cleared
when this exception is thrown.public boolean isGreen()
Copyright © 2017. All rights reserved.