MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / main

Method main

Programs/SwitchCase.java:5–29  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

3import java.util.Scanner;
4public class SwitchCase {
5 public static void main(String[] args) {
6 // TODO Auto-generated method stub
7 Scanner sc = new Scanner(System.in);
8 System.out.println("Enter a number from 1 to 5: ");
9 int num = sc.nextInt();
10 switch (num) {
11 case 1:
12 System.out.println("You have entered 1.");
13 break;
14 case 2:
15 System.out.println("You have entered 2.");
16 break;
17 case 3:
18 System.out.println("You have entered 3.");
19 break;
20 case 4:
21 System.out.println("You have entered 4.");
22 break;
23 case 5:
24 System.out.println("You have entered 5.");
25 break;
26 default:
27 System.out.println("You have entered a number less than 1 or greater than 5.");
28 }
29 }
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected