Compiler Error J0011

Expected ':'

The compiler expected to find a colon following a case label or in a conditional expression that makes use of the ternary operator. This error usually occurs when a colon is accidentally omitted. Many times this error is caused on the line previous to the line the compiler has reported the error on. Ensure that the lines that require a colon are correct and compile again.

The following example illustrates this error:

public class Simple {
   
   private int i;
   private static int x = 1;
   
   public void method1(int arg1) {
   
      switch (arg1) {
         case 1 // error: ':' omitted after 'case 1'
      }
   
      i = ( arg1 < x) ? arg1  x; // error: ':' omitted after 'arg1'
   }
}