Switch program failure
I wrote this program to practice using multiple programs(i'm 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;
defau开发者_如何转开发lt:
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.");
}
}
The keyword switch
should start with lower-case 's'
精彩评论