Switch Statement
Why if I enter in the following code a number less than 0 or greater than 12 it does not display "Out of range"? import java.util.Scanner; public class Program { public static void main(String[] args) { int year; Scanner yearScan = new Scanner(System.in); year = yearScan.nextInt(); if (year >= 1 || year <= 12) { switch (year) { case 1: System.out.println("January"); break; case 2: System.out.println("February"); break; case 3: System.out.println("March"); break; case 4: System.out.println("April"); break; case 5: System.out.println("May"); break; case 6: System.out.println("June"); break; case 7: System.out.println("July"); break; case 8: System.out.println("August"); break; case 9: System.out.println("Septembery"); break; case 10: System.out.println("October"); break; case 11: System.out.println("November"); break; case 12: System.out.println("December"); break; } } else { System.out.println("Out of range"); } } }