Converting Java Help3 System into Class and Subroutine Practice

This is Java for Beginner’s Guide. Java is one of an ideal Object Oriented Programming (OOP) language to learn for your programming career. Along the way, you will encounter branches and conditional statements such as if, switch, for, while, do-while, break, and continue statement. Learning Blocks {} is essential to continue this course since it separates logic of your syntax coded. As for the basic programming, you may encounter the basic Help 3 System in Java. See source code at

Help3 System source code is a finish code to start your programming practice. There are free programming environment such as eclipse and netbeans to handle the source code but if you prefer to use the native Command-Line-Interface (Windows) or Terminal (Mac) will still work.

Subroutine Java Help3 System: An Example Source Code

The image below is the output from the console.
java help 3 system

Name your Class as source code to run in your programming environment.

* An Example of Class with Subroutines for Java Help3 System.
*This program provides a help system that displays the syntax for the Java control statements such as such as if, switch, for, while, do-while, break, and continue statement. 
* It will ask the user which options will be displayed.

public class Help3 {
    public static void main(String args[]) 
        throws {

        for(;;) {

        	libClass.incUnderForLoop(); //libClass and incUnderForLoop subroutine embedded


class libClass { 							// Another class has been created

	static char choice;						// Member variable

	public static void incUnderForLoop() {			

		Switches();							// Switches subroutine is embedded here


        switch(choice) {
            case '1':
                System.out.println("The if:\n");
                System.out.println("if(condition) statement;");
                System.out.println("else statement;");
            case '2':
                System.out.println("The switch:\n");
                System.out.println("switch(expression) {");
                System.out.println(" case constant:");
                System.out.println(" statement sequence");
                System.out.println(" break;");
                System.out.println(" // ...");
            case '3':
                System.out.println("The for:\n");
                System.out.print("for(init; condition; iteration)");
                System.out.println(" statement;");
            case '4':
                System.out.println("The while:\n");
                System.out.println("while(condition) statement;");
            case '5':
                System.out.println("The do-while:\n");
                System.out.println("do {");
                System.out.println(" statement;");
                System.out.println("} while (condition);");
            case '6':
                System.out.println("The break:\n");
                System.out.println("break; or break label;");
            case '7':
                System.out.println("The continue:\n");
                System.out.println("continue; or continue label;");



	static void Switches() {							// 		Switches Subroutine

		do {
            System.out.println("Help on:");
            System.out.println(" 1. if");
            System.out.println(" 2. switch");
            System.out.println(" 3. for");
            System.out.println(" 4. while");
            System.out.println(" 5. do-while");
            System.out.println(" 6. break");
            System.out.println(" 7. continue\n");
            System.out.print("Choose one (q to quit): ");
            doLoop(); 										// doLoop subroutine embedded
        } while( choice < '1' | choice > '7' & choice != 'q');

		optionExit();									// optionExit subroutine embedded

	static void doLoop() {								// doLoop Subroutine
		do {
            choice = TextIO.getChar();
        } while(choice == '\n' | choice == '\r'); 


	static void optionExit(){
		if (choice == 'q') {
			System.exit(0);									// I change break; to System.exit(0); function

}	   													// end of libClass 


The code above chopped the original Java Help3 System source code, it will still display same result with the practice of subroutines and classes. You can revise it yourself to make more classes and subroutines.

Elvin is one of the contributors of He has been creating Wordpress Plugins, Magento Extensions, & Mobile Applications. If you find this article useful, please Follow him on .
About Elvin D.

One thought on “Converting Java Help3 System into Class and Subroutine Practice”

Leave Your Thought