What will be the output of the program? Class equals { public static void main(string [] args) { int x = 100; double y = 100.1; boolean b = (x = y); system.Out.Println(b); } }?
Answers
Answered by
3
Answer:
Explanation:
if boolean b= (x=y) is given
then ,it will rise to error since here value is assigned and you can't convert int or double to boolean
but if boolean b= (x==y) is given
then it will produce output
false
since int will be converted to double then compared with another double value
100.0 is not equal to 100.1
you can check it will be true if you declare double y= 100.0
Similar questions