Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of

The boolean 'entir', initially set at true, plays an important part.

When the button btnfill is clicked first, the actionPerformed method is executed.

In it, our method fillTheArea is called :

In this method a counter is added to a TextArea 200 times :

We then return to the actionPerformed method and leave it :

If the other button, btnpartall, is clicked, the if's statements in actionPerformed are skipped and we arrive at :

causing the boolean to be set to false, ! meaning NOT, so true changes to false (and the other way around, next time).

Now when btnfill is clicked, the loop is left prematurely, because the condition is true in its totality as soon as the counter i hits 7,
! means NOT ,
&& means AND.

Then of course the break statement is executed,...

causing the program to leave the loop at that moment and continue here.


Logical operators.


The break statement is also used to exit a switch.

rating's value is used...

to jump to the matching case.

Falls through...

and executes these statements, where the break statement causes the switch to be left...

and continue here.

breaks are important in a switch, because they mean : case done, leave the switch.

In this example, however, both a value of 2 as well as 3 result in rats being "cool".

The switch argument can only be an integer or a char . Alas, no strings etc.




Curly brackets.

Round brackets.