Skip to content

Commit 4d971f6

Browse files
committed
Added Practice Demo Code3.
Signed-off-by: Someshdiwan <Someshdiwan369@gmail.com>
1 parent 2e7170e commit 4d971f6

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.io.IOException;
2+
class Demo3 {
3+
public static void main(String[] args)
4+
{
5+
try
6+
{
7+
int x = System.in.read();
8+
System.out.println( (char)x);
9+
}
10+
catch (IOException e)
11+
{
12+
System.out.println(e);
13+
}
14+
}
15+
}
16+
/*
17+
This program reads one character from the keyboard input (System.in.read()) and prints it.
18+
It captures any input/output exceptions that might occur during reading.
19+
20+
Basically, it waits for you to press a key and then shows that character.
21+
*/

0 commit comments

Comments
 (0)