Revision: 475
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 15, 2006 03:44 by cetnar
Initial Code
public void testSwitchStatement(PrintStream out) throws IOException {
StringBuffer outputText = new StringBuffer(student1.getFullName( ));
switch (student1.getGrade( )) {
case A:
outputText.append(" excelled with a grade of A");
break;
case B: // fall through to C
case C:
outputText.append(" passed with a grade of ")
.append(student1.getGrade( ).toString( ));
break;
case D: // fall through to F
case F:
outputText.append(" failed with a grade of ")
.append(student1.getGrade( ).toString( ));
break;
case INCOMPLETE:
outputText.append(" did not complete the class.");
break;
}
out.println(outputText.toString( ));
}
Initial URL
Initial Description
- Tiger simply requires that you not preface each enumerated type with the enum class name - if not handling every enumerated type - warining will be displayed that not all of enum values not being compile time constants
Initial Title
Switching on enums
Initial Tags
Initial Language
Java