Hi, Can anybody explain the output of the following code?
public class Test{
double d1=1.0;
double d2=0.0;
d1=d1/d2;
byte b = (byte)d1;
public static void main (
String[] args){
System.out.println("b value is" + b);
}}
the given answer is -1. the mysterious part of this code is the casting d1 to b (which is of type byte). But at this moment d1 is infinity. How can this be done?