7:45 pm - Thursday April 25, 2019

Double Example Program for isNaN()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
 *Double Example Program for IsNaN()
 * @author: candidjava.com
 * This method Returns true if this Double value is a Not-a-Number (NaN), false otherwise.
 */
import java.lang.Double;

public class IsNaNDouble {
	public static void main(String args[]) {
		double f = (double) Math.sqrt(-1.0 / 1.0);
		// Returns true Since this Double value is Not-a-Number (NaN).
		boolean b1 = Double.isNaN(f);
		System.out.println(b1);
		Double f1 = new Double(9.69);
		// Returns False Since this Double value is Not-a-Number (NaN).
		boolean b2 = Double.isNaN(f1);
		System.out.println(b2);

	}
}




Output:
true
false

Filed in: Z-A All Java Codes

Comments are closed.