0Pricing
Java Academy · Lesson

Input & Expressions – Part 1

Read numeric input with Scanner, apply arithmetic operators, and understand precedence and integer vs floating-point division.

Lesson Goals

Goals

  • Read numbers with Scanner.
  • Use + - * / %.
  • Understand precedence and integer vs floating division.

Scanner Setup

Scanner setup

import java.util.Scanner;
Scanner sc = new Scanner(System.in);

Use sc to read input from the keyboard in the console.

All lessons in this course

  1. Variables & Data Types
  2. Input & Expressions – Part 1
  3. Input & Expressions – Part 2
← Back to Java Academy