Menu
Coddy logo textTech

Getting Numbers

Part of the Fundamentals section of Coddy's Java journey — lesson 39 of 73.

challenge icon

Challenge

Beginner

Modify the given code to get two numbers from the user and store them in variables named num1 and num2. Use the Scanner class and its nextDouble() method to read the numbers. After getting the numbers, print them to the console using System.out.println to verify the input in the following format:

First number: ...
Second number: ...

Don't forget! Import the Scanner library at the top of your program in order to use it:

import java.util.Scanner;

Try it yourself

public class Main {
    public static void main(String[] args) {
        System.out.println("Calculator App");
    }
}

All lessons in Fundamentals