Home> Java> javaTutorial> body text

Try This: Complete the Java help system

WBOY
Release: 2024-07-17 19:57:03
Original
372 people have browsed it

This version adds break and continue syntax.
It also allows the user to request the syntax of more than one statement. It does this by adding an external loop that runs until the user enters q as a menu selection.

  1. Copy Help2.java into a new file called Help3.java

  2. Include all program code in an infinite for loop. Exit this loop, using break, when a letter q is inserted. Since the loop encompasses the entire program code, exiting it causes the program to terminate.

  3. Change the menu loop as shown here:
    Image description

Notice that this loop now includes break and continue statements. It also accepts the letter q as a valid option.

  1. Expand the switch statement to include the break and continue statements, as shown below:Image description

The above is the detailed content of Try This: Complete the Java help system. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!