public class MainClass{ public static void main(String[] argv){ int temp = 90; switch(temp) { case 80 : System.out.println("80"); case 80 : System.out.println("80"); // won't compile! case 90 : System.out.println("90"); default : System.out.println("default"); } } }
Exception in thread "main" java.lang.Error: Unresolved compilation problems: Duplicate case Duplicate case at MainClass.main(MainClass.java:5)