ข้ามไปยังเนื้อหา

Numbers: division, casting and overflow

English

Numbers that surprise you

  • Java keeps two kinds of number apart: int (whole numbers) and double (numbers with a decimal point).
  • The type of the values decides the answer. 7 / 2 and 7 / 2.0 give different results.
  • Multiple-choice questions test this all the time: integer division, %, casting, and what happens when an int gets too big.

เข้าสู่ระบบหรือสร้างบัญชี

IGCSE, A-Level & AP