This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Exiting a program through a switch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exiting a program through a switch" Watch "Exiting a program through a switch" New topic

Exiting a program through a switch

Chris Buskulic

Joined: Sep 23, 2003
Posts: 5
I was wondering how I would go about coding an exit for a program in a switch statement. Heres a sample of my code:
switch (option) {
case 'C':
case 'c':
pay *=hours;
System.out.println("Gross pay is" +Utility.moneyFormat(balance));
case 'A':
case 'a':
System.out.println("Chris Buskulic");
case 'E':
case 'e':
E is my exit choice through a menue given to the user.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33132


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
It is sorta covered in the JavaRanch Style Guide.
subject: Exiting a program through a switch
It's not a secret anymore!