A criticism of the break statement and the continue statement is that each is unstructured. Actually, these

Question:

A criticism of the break statement and the continue statement is that each is unstructured. Actually, these statements can always be replaced by structured statements, although doing so can be awkward. Describe in general how you’d remove any break statement from a loop in a program and replace it with some structured equivalent. The break statement exits a loop from the body of the loop. The other way to exit is by failing the loop-continuation test. Consider using in the loop-continuation test a second test that indicates “early exit because of a ‘break’ condition.” Use the technique you develop here to remove the break statement from the application in Fig. 4.11.

Fig. 4.11

I // Fig. 4.11: BreakTest.java 2 // break statement exiting a for statement. public class BreakTest { public

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: