I was giving a exam when i got this question What is the Output of following question
public class ClassicQuestion {
public static void main(String[] args)
{
int i = 25;
double j = 95.0;
System.out.println(j+=i);
System.out.println(i+=j);
}
}
And the option for answer was
- compile time error
- run time error
- 120.0 145
- 120.0 120
I don't know the correct answer but i thought correct answer would be one, but showed me incorrect answer? how can we assign one variable to different types of data types without conversion ?