tags:

views:

28

answers:

1

I wrote this program to practice using multiple programs(im using eclipse). and I can't get the switch statement to work properly:

Eclipse keeps telling me that there is a syntax error on the token case and an assert is expected?

public class MultiClass {
 public static void main(String args[]) {
  MultiClassTwo MCT = new MultiClassTwo();
  MultiClassThree MCTT = new MultiClassThree();
  MultiClass4 MCF = new MultiClass4();

  int determiner;
  determiner = 1;

  Switch(determiner) {
   case 1:
    MCT.simpleMessage();
    break;
   case 2:
    MCTT.simpleMessage();
    break;
   case 3:
    MCF.simpleMessage();
    break;
   default:
    System.out.println("This is the first class.");
  }
 }
}

and here are the seperate files for the other classes:

public class MultiClassTwo {
 public void simpleMessage() {
  System.out.println("This is the second class.");
 }
}

public class MultiClassThree {
 public void simpleMessage() {
  System.out.println("This is the third class.");
 }
}


public class MultiClass4 {
 public void simpleMessage() {
  System.out.println("This is the fourth class.");
 }
}
+2  A: 

The keyword switch should start with lower-case 's'

Jim Garrison
http://download-llnw.oracle.com/javase/tutorial/java/nutsandbolts/switch.html for more info.
Nitrodist