javascript
Brief description  about Online courses   join in Online courses
View Sangita  Biswal 's Profile

Arithmatic Exception

import java.io.*;

class ExceptionTryBlock{
public static void main(String args[])
{
float pi=3.143f;
float r,area;
try{
DataInputStream d=new DataInputStream(System.in);



r=Float.parseFloat(d.readLine());
area=pi*r*r;
System.out.println("The area of the Circle is" area);
}
catch(Exception e){}




}}

How can a program for area of a circle can throw arithmatic exception? I only know one arithmatic exception that is division by zero.plz help
Asked by Sangita Biswal | Dec 16, 2010 |  Reply now
Replies (2)
View kannan krr 's Profile
try to get value for r as follows

r=Float.valueOf(radius.readFloat());
Dec 24, 2010
View arun kumar das 's Profile
Hi

in case of infinity arithmetic exception is coming.

java teacher
Dec 24, 2010