TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  Design13Checked automatically with code checker

Synopsis:The default label should be the last label in a switch statement
Language:Java
Severity Level:3
Category:Design


Description:
By convention, the default label should be the last label in a switch statement.
public class Foo {
 void bar(int a) {
  switch (a) {
   case 1:  // do something
      break;
   default:  // the default case should be last, by convention
      break;
   case 2:
      break;
  }
 }
}