• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primitive Data Type

 
sr shashidhar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the below program,

Only while using


Java Compiler gives Exception as

Exception in thread "main" java.lang.ArithmeticException: / by zero

Why not for Floating or Double type...?





Output:


 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have already answered your own question. Because the IEEE745 floating‑point datatypes support ±∞ (and NaN), and the unsigned and two’s complement integer types do not support ∞.
 
sr shashidhar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks Campbell Ritchie.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You’re welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic