Compiler Error J0091

'case' outside of switch statement

The compiler identified the keyword case used outside the scope of a switch statement.

The following example illustrates this error:

public class Simple {
   
   public int method1() {
      case 1: // error: no switch statement
         return 1;
   }
}