Читать книгу OCP Oracle Certified Professional Java SE 17 Developer Study Guide - Jeanne Boyarsky - Страница 212
Reviewing Branching
ОглавлениеWe conclude this section with Table 3.1, which will help remind you when labels, break
, and continue
statements are permitted in Java. Although for illustrative purposes our examples use these statements in nested loops, they can be used inside single loops as well.
TABLE 3.1 Control statement usage
Support labels | Support break | Support continue | Support yield | |
---|---|---|---|---|
while | Yes | Yes | Yes | No |
do/while | Yes | Yes | Yes | No |
for | Yes | Yes | Yes | No |
switch | Yes | Yes | No | Yes |
Last but not least, all testing centers should offer some form of scrap paper or dry-erase board to use during the exam. We strongly recommend you make use of these testing aids, should you encounter complex questions involving nested loops and branching statements.
Some of the most time-consuming questions you may see on the exam could involve nested loops with lots of branching. Unless you spot an obvious compiler error, we recommend skipping these questions and coming back to them at the end. Remember, all questions on the exam are weighted evenly!