Please enable JavaScript to use CodeHS

Chapter 1

Primitive Types

1.4 Expressions and Assignment Statements

Arithmetic Expressions

Addition Operator

Subtraction Operator

Multiplication Operator

Division Operator

Types of Division

Arithmetic Exceptions

Modulus Operator

Operation Precedence

Calculator

Temperature Conversion

Tricky Java

Check Your Understanding

  1. Incorrect Correct No Answer was selected Invalid Answer

Exercise: Fractions

Vocabulary

Term Definition
Modulus operator The modulus operator (written as % in most programming languages) divides two numbers and returns the remainder.
Integer Division When two integers are divided, the decimal values are truncated, or chopped off.
Order of Operations The order in which mathematical expressions should be evaluated. Starts with Parentheses, Exponents, Multiplications and Division, Addition and Subtraction.
Literal The fixed value being assigned to a variable. Often primitive data types.
ArithmeticException Exception that is thrown to warn programmers about arithmetic errors in their code.