Write a Locker that starts locked with a code given to the constructor. unlock takes a guess and only opens when it matches. lock closes it again. isOpen reports the state.
class Locker { Locker(int code); void unlock(int guess); void lock(); boolean isOpen(); }
Examples
There are also 3 hidden tests you can't see. Solve the problem, not the examples.