hi,
the following program gives -1 as o/p.
while i was thinking it will raise an exception commented line.
coz here after the division operation d1 has got 'infinity' as its value. so how we r putting infinity in a byte.
class Question {
public static void main(String[] args)
{
double d1 = 1.0;
double d2 = 0.0;
byte b = 1;
d1 = d1 / d2;
b = (byte) d1; //// commented line
System.out.print(b);
}
}
regards
deekasha