|
|
| TestBankAccount.java |
case 'h': // help
System.out.print(
"b get current balance\n"
+ "d deposit some money\n"
+ "h this help text\n"
+ "w withdraw some money\n"
+ "x leave the program\n"
);
break;
case 'x': // exit
break;
default:
System.out.println("Unknown command. "
+ " Please try ``h'' for help!");
break;
}
|
![]() | Note how the default case is used to catch invalid
commands.
|
|
| Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002 |