I\'m making a simple calculator for this homework, and Java is returning \"Infinity\" when divided by 0.
I need to display some error message, when I get infinity. T
There are two fields for infinity in the Double class: POSITIVE_INFINITY and NEGATIVE_INFINITY which you can check for.
Note that integer division by zero would throw an ArithmeticException thus your line would have to be 4.0/0, 4/0.0 or 4.0/0.0 since 4 and 0 are integers and thus result in integer math.