Skip to content

Commit 52ad049

Browse files
committed
feat: Implement switch-case to display day name based on input number
🧠 Logic: - Prompt user for a day number (1–7) using Scanner. - Use a `switch` statement to map: 1 → Monday, 2 → Tuesday, 3 → Wednesday, ..., 7 → Sunday. - For any number outside this range, default case handles invalid input. - Demonstrates use of classic `switch` syntax with `break` statements. Signed-off-by: Somesh diwan <[email protected]>
1 parent f1cafaf commit 52ad049

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Section7ConditionalStatements/src/SwitchCaseAB1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//Display name of the day based on the number.
1+
//Display the name of the day based on the number.
22

33
//The 'switch' statement cannot be used to compare string values; it only works with integral or enumeration types
44

0 commit comments

Comments
 (0)