Practice mode Java

What is the output of the Java statement System.out.println(10 / 4);?

Correct answer D. 2

Explanation

Both 10 and 4 are int literals, so Java performs integer division and simply drops the fractional part, printing 2 rather than 2.5.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.