Define a public class named Flip
with a single public instance method named flop
that takes no parameters and
returns a Boolean
.
Flip
should also provide a single public constructor that accepts a Boolean
argument and sets the initial
state of
the Flip
instance.
Flip
maintains one piece of private state: the boolean
.
Calling flop
changes the boolean
from true
to false
or false
to true
and returns the new (not the
old) state of the boolean
.
So, for example:
Note that the internal state should be private.
Stuck? You may find these lessons helpful: