/*PROG 19.34 USAGE OF FEW METHODS OF FLOAT/DOUBLE CLASS VER 2 */
import java.util.*;
import java.io.*;
class JPS34
{
static void show(String s)
{
System.out.println(s);
}
public static void main(String args[])
{
boolean b1 = new Double(34/0.).isInfi nite();
boolean b2 = Double.isInfi nite(34/0.);
show(“\n34/0 is infi nite : “ + (b1&&b2));
b1 = new Double(0/0.).isNaN();
b2 = Double.isNaN(0/0.);
show(“\n0/0 is Not a Number: “ +(b1&&b2));
}
}
OUTPUT:
34/0 is infi nite : true
0/0 is Not a Number: true
Explanation: The isInfinite and isNaN method has two ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.