This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Primitive Data Type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Primitive Data Type " Watch "Primitive Data Type " New topic
Author

Primitive Data Type

sr shashidhar
Greenhorn

Joined: Jan 17, 2013
Posts: 27
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

Joined: Oct 13, 2005
Posts: 37936
    
  22
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

Joined: Jan 17, 2013
Posts: 27

Thanks Campbell Ritchie.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37936
    
  22
You’re welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Primitive Data Type
 
Similar Threads
question about variables changed inside methods
Plot update error - JMathPlot
Ininifty as the answer
Chapter 5 K&B -Doubt
Negative number divide by zero?