Skip to content

Commit e1f7262

Browse files
committed
feat: Categorize website type based on domain extension using switch-case
🧠 Logic: - Accepts a website URL as user input and extracts the domain extension using `substring` after the last dot. - Uses a `switch-case` structure to identify and print the website type: - `.com` → Commercial Website - `.org` → Organization - `.gov` → Government - `.net` → Network - Converts extension to lowercase for case-insensitive matching. - Demonstrates practical string handling and conditional branching based on web domain classification. Signed-off-by: Somesh diwan <[email protected]>
1 parent e214f4f commit e1f7262

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Section7ConditionalStatements/src/SwitchCasesAB4.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public static void main(String[] args) {
2626
case "net":
2727
System.out.println("Network");
2828
break;
29+
30+
default: System.out.println("Invalid Domain");
2931
}
3032
}
3133
}

0 commit comments

Comments
 (0)