Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Switch Statement

 
Atah Tabotnjap
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");
break;
case 1: System.out.print("1 ");
break;
case 2: System.out.println("2");
break;
}
}
}

What should i expect ?

Thanks in advance
 
Hiremath Patil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Check spelling of "switsch" .
It should be switch

Thanks
Hiremath
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

That was easy. couldn't see it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic