File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "output" Watch "output" New topic
Author

output

Rahul Pawar
Ranch Hand

Joined: Mar 13, 2001
Posts: 38
class Q81{
public static void main(
String args[]){
System.out.print(
Double.isNaN(3.0%0));
System.out.print(" ");
System.out.println(
Double.isNaN(3.0/0));
}//end main()
}//end class definition
what is the output of above program and y ?
thanks
rahul
Kishore Pamu
Ranch Hand

Joined: Mar 18, 2001
Posts: 35
The output of the above code is :
true false.
because 3.0%0 gives NaN and 3.0/0 gives infinity.

Kishore
sai challa
Ranch Hand

Joined: Feb 06, 2001
Posts: 54
Originally posted by Rahul Pawar:
class Q81{
public static void main(
String args[]){
System.out.print(
Double.isNaN(3.0%0));
System.out.print(" ");
System.out.println(
Double.isNaN(3.0/0));
}//end main()
}//end class definition
what is the output of above program and y ?
thanks
rahul

The output of the above program is true false.
Dividing a double by zero produces the result of Infinity.The value 'Infinity' indicates an effectively infinite result,in that it is greater than the largest number that can be represented as type double.
The operation 3.0%0 produces an indeterminate result.Hence the value of the output will be NaN.The value is referred to as Not-a-Number,indicating an indeterminate value.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: output
 
Similar Threads
How to round a float with a 0.25 step
Doubt in the output of this program.
call by reference
Wrapper Classes.
Wrappers