Solution: Arithmetic Operations

This program prints three math results using System.out.println(...).

  • Java starts running in main.

  • Each println evaluates the expression inside the parentheses, then prints the answer.

Code

  • System.out.println(5 + 7 + 3); → prints 15

  • System.out.println(6 * 8); → prints 48

  • System.out.println(20 / 2.0); → prints 10.0
    (2.0 makes the division decimal-style)

Solution: Arithmetic Operations

This program prints three math results using System.out.println(...).

  • Java starts running in main.

  • Each println evaluates the expression inside the parentheses, then prints the answer.

Code

  • System.out.println(5 + 7 + 3); → prints 15

  • System.out.println(6 * 8); → prints 48

  • System.out.println(20 / 2.0); → prints 10.0
    (2.0 makes the division decimal-style)