P
priyom
Please got through the following code snippet.
class NanTest {
public static void main ( String args [ ] ) {
int intX = 10 ; // line 1
float floatX = 10 ; // line 2
double doubleX = floatX / 0 ; // line 3
double doubleY = intX / 0 ; // line 4
System . out . println ( doubleX == doubleY ) ; // line 5
}
}
It throws exception on line 4 but not on line 3.
Could anyone please explain this.
class NanTest {
public static void main ( String args [ ] ) {
int intX = 10 ; // line 1
float floatX = 10 ; // line 2
double doubleX = floatX / 0 ; // line 3
double doubleY = intX / 0 ; // line 4
System . out . println ( doubleX == doubleY ) ; // line 5
}
}
It throws exception on line 4 but not on line 3.
Could anyone please explain this.