• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

arithmetic exception

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) ArithmeticException will occur after execution of the following code
int i = 10;
float f = 0.0;
double d = i/f;

NO.
this is the answer and i can't understand it .i think that float f is 0 so divide by zero give arithmetic exception. may be this answer is becoz it give runtime error not exception am i right?
ronak please help.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
integers give an ArithmeticException when division by zero occurs. A float divided by zero will give positive infinity, negative infinity or NaN.

This question does not belong in the JavaRanch forum. The JavaRanch forum is for discussion of the JavaRanch site, not questions about Java. I'm moving this to Java in General (beginner).
 
reply
    Bookmark Topic Watch Topic
  • New Topic