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 Junior/Associate Certification (SCJA,OCAJ 5/6/8) and the fly likes Switch Statement 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 » Certification » Junior/Associate Certification (SCJA,OCAJ 5/6/8)
Bookmark "Switch Statement" Watch "Switch Statement" New topic

Switch Statement

Atah Tabotnjap

Joined: Mar 17, 2008
Posts: 24
Hi guys

I have tried to compile and run this small class, but i only get 2 errors:

public class SwitchCheck {
public static void main(String[] args) {
int i = 4;
switsch (i) {
default: System.out.print("default");
case 1: System.out.print("1 ");
case 2: System.out.println("2");

What should i expect ?

Thanks in advance
Hiremath Patil

Joined: Sep 19, 2008
Posts: 1

Check spelling of "switsch" .
It should be switch

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

The first problem is probably triggering the second. Don't hesitate to post the actual error messages when you're stuck!

-Cameron McKenzie
Atah Tabotnjap

Joined: Mar 17, 2008
Posts: 24

That was easy. couldn't see it.
I agree. Here's the link:
subject: Switch Statement
It's not a secret anymore!