File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Associate Certification (SCJA,OCAJ 5/6) 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Associate Certification (SCJA,OCAJ 5/6)
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Switch Statement
Similar Threads
switch case basic
Do while error, I'm going crazy
dan's control flow questions
Numeric value convert to word format
Unreachable statement