Java- Multiple switch statement using advance/new type

enter image description hereI am trying to use this format for the switch statement but getting error in eclipse but somehow it is not throwing error in intellij. What needs to be changed?

public static void main(String[] args) {
    // TODO Auto-generated method stub
    int switchValue = 3;
    
    switch(switchValue) {
    case 1: System.out.println("Value was 1");
    case 2: System.out.println("Value was 2");
    case 3,4,5 ->
    {
        System.out.println("Value was 3");
    }
    
    default -> System.out.println("Was not 1,2,3,4 or 5");
    }
}

Exception in thread “main” java.lang.Error: Unresolved compilation problem:
Mixing of different kinds of case statements ‘->’ and ‘:’ is not allowed within a switch

at keywords.Switchhh.main(Switchhh.java:12)

Read more here: Source link