Skip to content

Commit 30a0607

Browse files
committed
feat: Demonstrate switch statement variations for fruit and day categorization
🧠 Logic: - Takes user input and shows two switch-case use cases: 1. **Commented block**: Categorizes fruits with switch expression syntax (`->`) and default fallback. 2. **Active block**: Classifies numeric days into "Weekday" and "Weekend" using both traditional and enhanced switch syntax. - Uses modern Java syntax for clean and concise control flow. Signed-off-by: Somesh diwan <[email protected]>
1 parent 97efc34 commit 30a0607

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Section7ConditionalStatements/Practice/src/Main.java renamed to Section7ConditionalStatements/Practice/src/SwitchCases.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import java.util.Scanner;
22

3-
public class Main {
4-
3+
public class SwitchCases {
54
public static void main(String[] args) {
65
Scanner in = new Scanner(System.in);
76
// String fruit = in.next();
@@ -43,6 +42,5 @@ public static void main(String[] args) {
4342
case 1, 2, 3, 4, 5 -> System.out.println("Weekday");
4443
case 6, 7 -> System.out.println("Weekend");
4544
}
46-
4745
}
4846
}

0 commit comments

Comments
 (0)