fork download
public enum Days { 
  		SUN("11 - 5"), MON("9 - 9"), TUE("9 - 9"), WED("9 - 9"), THU("9 - 9"), FRI("9 - 9"), SAT("9 - 6"); 
  	 
  		private String hours; 
  		 
  		private Days(String h) 
  		{ 
  			hours = h; 
  		} 
  	} 
  	public static void main(String[] args) 
  	{ 
  		Scanner in = new Scanner(System.in); 
  		 
  		Days aDay; 
  		String input = ""; 
  		 
  		for (Days day : Days.values()) 
  		System.out.print(day + " "); 
  		 
  		System.out.print("\nPlease pick a day: "); 
  		input = in.nextLine().toUpperCase(); 
  		 
  		if (input.length() > 3) 
  			input = input.substring(0, 3); // trimming in case user inputs full day name 
  		 
  		try // I have a peeve about seeing errors even from unexpected input 
  		{ 
  			aDay = Days.valueOf(input); 
  			 
  			System.out.println("The hours for " + aDay + " are " + aDay.hours); 
  		} 
  		catch(Exception e) 
  		{ 
  			if (input.isEmpty()) 
  				System.out.println("Nothing entered exiting."); 
  				 			else 
  				System.out.println("Error: Invalid entry!\n\t" + e); 
  		} 
  	} 
  	
   } 


 
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: class, interface, or enum expected
  	public static void main(String[] args) 
  	              ^
Main.java:16: error: class, interface, or enum expected
  		Days aDay; 
  		^
Main.java:17: error: class, interface, or enum expected
  		String input = ""; 
  		^
Main.java:19: error: class, interface, or enum expected
  		for (Days day : Days.values()) 
  		^
Main.java:22: error: class, interface, or enum expected
  		System.out.print("\nPlease pick a day: "); 
  		^
Main.java:23: error: class, interface, or enum expected
  		input = in.nextLine().toUpperCase(); 
  		^
Main.java:25: error: class, interface, or enum expected
  		if (input.length() > 3) 
  		^
Main.java:28: error: class, interface, or enum expected
  		try // I have a peeve about seeing errors even from unexpected input 
  		^
Main.java:32: error: class, interface, or enum expected
  			System.out.println("The hours for " + aDay + " are " + aDay.hours); 
  			^
Main.java:33: error: class, interface, or enum expected
  		} 
  		^
Main.java:38: error: class, interface, or enum expected
  				 			else 
  				 			^
Main.java:40: error: class, interface, or enum expected
  		} 
  		^
12 errors
stdout
Standard output is empty