← Java from Scratch Lesson 5 of 88 · 5 XP

Warm-up: a number from the input warm-up

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

Scanner reads the input. in.nextInt() takes the next integer:

Scanner in = new Scanner(System.in);
int n = in.nextInt();
System.out.println(n * 2);

Task. Read an integer and print it multiplied by 2.

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.