-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path38_SimpleSwitch.java
More file actions
43 lines (40 loc) · 973 Bytes
/
38_SimpleSwitch.java
File metadata and controls
43 lines (40 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Simple Switch Case Program
*/
package javaprograms;
import java.io.*;
/**
*
* @author Geeky Keshav
*/
public class SimpleSwitch
{
public static void main(String [] args)throws Exception
{
DataInputStream obj=new DataInputStream(System.in);
String s;
s=obj.readLine();
int a=Integer.parseInt(s);
String msg;
switch(a)
{
case 1:
msg="This is number 1";
break;
case 2:
msg="This is number 2";
break;
default:
msg="no suitable numbers";
}
System.out.println(msg);
}
}
/****OUTPUT****
**When given input is:
* 1
This is number 1
* When given input is:
* 12
*no suitable numbers
*/