Examveda

What is the result of the expression 10 / 3 in Java?

A. 3.3333

B. 3

C. 3.1

D. 4

Answer: Option B

Solution (By Examveda Team)

In Java, both 10 and 3 are integer values.

When an arithmetic operation is performed between two integers, Java uses integer division.

Integer division discards the fractional (decimal) part of the result instead of rounding it.

So, the expression 10 / 3 evaluates to 3, not 3.3333 or 3.1.

This Question Belongs to Java Program >> Operators

Join The Discussion

Comments (1)

  1. Tamerat Mekonnen
    Tamerat Mekonnen:
    2 months ago

    This supposed to be dependent on the datatype, right? if the datatype is int yes, it is 3 but double and float will be different.

Related Questions on Operators