![]() |
![]() |
![]() |
![]() |
![]() |
|
Note that you do not need to perform a cast, of the sort you learned about in Segment 93, if you want a program to compare an integer with a floating-point number. Java will perform the cast automatically, as illustrated by the following program:
public class Demonstrate {
public static void main (String argv[]) {
int i = 50; double d = 50.0;
System.out.println(i == d);
System.out.println(i != d);
}
}
--- Result ---
true
false