

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Double isNaN() method in Java
The java.lang.Double.isNan() method returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.
Let’s say the following are our Double values.
Double val1 = new Double(3/0.); Double val2 = new Double(0/0.);
Now, we will use the isNan() method to check whether the number is a NaN or not.
val1.isNaN(); val2.isNaN()
The following is our final example.
Example
public class Demo { public static void main(String args[]) { Double val1 = new Double(3/0.); Double val2 = new Double(0/0.); System.out.println(val1.isNaN()); System.out.println(val2.isNaN()); } }
Output
false true
- Related Questions & Answers
- Java Float isNaN() Method
- Double isInfinite() method in Java
- isNAN() function in JavaScript
- Java Program to convert Double into String using toString() method of Double class
- Why is isNaN(null) == false in JS?
- Double brace initialization in Java
- Format double type in Java
- How to Convert Double to String to Double in Java?
- Convert double primitive type to a Double object in Java
- Java Double compare example
- Check for illegal number with isNaN() in JavaScript
- Explain about Double-declining balance method in accounting.
- Convert double to string in Java
- What is Double-buffering in Java?
- Convert Double to Integer in Java
Advertisements