Casting and Ranges of Variables

AP Computer Science A· difficulty 3/5

<code>int a = 7; double b = a / 2;</code><code>b</code> equals

  • A

    3

  • B

    3.0

    check_circle
  • C

    Compile error

  • D

    3.5

Explanation

Right side first: int division a/2 = 3; assigned to double → 3.0.

Want 10 more like this — adaptive to your weak spots?

Related questions