Learning objectives

Classify a data type as primitive or reference, and declare and initialize int, double and boolean variables, the only primitive types the course uses

Predict the exact text printed by System.out.print and System.out.println, including String literals that contain escape sequences for a quotation mark, a backslash or a new line, and expressions that join text to numbers

Evaluate arithmetic expressions built from +, -, *, / and % using operator precedence, and predict the result of integer division, of the remainder operator and of dividing an int by zero, which throws an ArithmeticException

Write assignment statements, compound assignment operators such as += and %=, and the ++ and -- operators, trace the value stored after each step, and describe how a Scanner can supply a value typed at the keyboard

Use the casts (int) and (double) to control whether arithmetic is done with whole or real numbers, explain that (int) truncates, and round a double to the nearest int with (int) (x + 0.5) or (int) (x - 0.5)

Explain integer overflow with reference to Integer.MAX_VALUE and Integer.MIN_VALUE, and explain why a calculation with double values can carry a round-off error

Continue with a revision plan

These learning objectives are available to everyone. Sign in with an eligible plan to read the full note and worked examples.