Java - Io.Bufferedreader Java - Io.Ioexception Java - Io.Inputstreamreader
Java - Io.Bufferedreader Java - Io.Ioexception Java - Io.Inputstreamreader
/*
2.
3.
4.
5.*/
6.
7.import java.io.BufferedReader;
8.import java.io.IOException;
9.import java.io.InputStreamReader;
10.
11.public class CalculateRectArea {
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.
int width = 0;
int length = 0;
try
{
//read the length from console
BufferedReader br = new BufferedReader(newInputStreamReader(System.in));
}
//if invalid value was entered
catch(NumberFormatException ne)
{
System.out.println("Invalid value" + ne);
System.exit(0);
}
catch(IOException ioe)
{
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
/*
* Area of a rectangle is
* length * width
*/
54.}
55.
56./*
57.Output of Calculate Rectangle Area using Java Example would be
58.Please enter length of a rectangle
59.10
60.Please enter width of a rectangle
61.15
62.Area of a rectangle is 150
63.*/