What does this Java method-body snippet print?
System.out.println(5 / 3);Answer & explanation
Answer: 1
Both operands are int, so integer division discards the fractional part for these positive inputs.
Practice primitive arithmetic with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
System.out.println(5 / 3);Answer: 1
Both operands are int, so integer division discards the fractional part for these positive inputs.