0
Why System.out.print(16.0/5); prints 3.2?
Why is the result of 16.0/5 -> 3.2?
5 Respuestas
+ 4
If you want print 16.0/5 use quotation marks.
System.out.println("16.0/5");
And if you want to know why the output is double and not int. It's because you used an operator(+, -, *, /) with an double, so Java used double here. 😉
+ 3
Hm, because... it is?
Maybe you should ask your maths teacher. ;-)
(Or tell us what you *actually* want to know.)
+ 1
João Vitor So according to you what should print here.
+ 1
Stefanoo I think that he want to know why output is double. You explained well.
+ 1
Yes, i ask because i didn't know that we could calculate double with int (i tought it must be same type). Thanks for the information! 👍