No. All the user knows is that something is wrong.
class ComboLock { public static void main ( String[] args ) { boolean correct = true; //First Number ... possibly change correct //Second Number ... possibly change correct //Third Number ... possibly change correct //Result if ( correct ) System.out.println("Lock opens"); else System.out.println("Lock does not open"); } } |
Check back to the flowhart and study how the boolean
variable correct
works.
In the program,
the if
statement is correclty written.
The boolean variable correct
will be
either true
or false
.
All that the if
statement needs is that.
You don't need to do this:
if ( correct == true )
because the boolean expression will merely evaluate to the
value that correct
already has.