Whats is the output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whats is the output?

public class Program { public static void main(String[] args) { double x = 3.6; double y = (int) x; System.out.print(y); } }

15th Oct 2017, 1:59 PM
مصعب خنيجر
مصعب خنيجر - avatar
1 Answer
+ 13
3.0 (int) x is 3 After saving it as a double variable, it becomes 3.0 You can try it out by yourself using code playground.
15th Oct 2017, 2:10 PM
Shamima Yasmin
Shamima Yasmin - avatar