Casting and Ranges of Variables

AP Computer Science A· difficulty 3/5

What does <code>(int) 3.7</code> evaluate to?

  • A

    4

  • B

    3

    check_circle
  • C

    3.7

  • D

    Compiler error

Explanation

Cast to <code>int</code> truncates toward zero (does not round): 3.

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

Related questions