Premium Only Content

How to Print an Integer entered by a user | Java Examples
In this program, you'll learn to print a number entered by the user in Java. The integer is stored in a variable using System.in, and is displayed on the screen using System.out.
In this program, an object of Scanner class, reader is created to take inputs from standard input, which is keyboard.
Then, Enter a number prompt is printed to give the user a visual cue as to what they should do next.
reader.nextInt()then reads all entered integers from the keyboard unless it encounters a new line character \n (Enter). The entered integers are then saved to the integer variable number.
If you enter any character which is not an integer, the compiler will throw an InputMismatchException.
Finally, number is printed onto the standard output (System.out) - computer screen using the function println().
-
2:00:33
GamerGril
3 hours agoThe Evil Within 2 💕 Pulse Check 💕 Still Here
6.22K1 -
LIVE
ttvglamourx
7 hours ago $0.81 earnedPLAYING WITH VIEWERS !DISCORD
139 watching -
5:59:31
TheManaLord Plays
8 hours agoMANA SUMMIT - DAY 2 ($10,200+) | BANNED PLAYER SMASH MELEE INVITATIONAL
20.4K1 -
LIVE
Jorba4
4 hours ago🔴Live-Jorba4- The Finals
71 watching -
LIVE
BBQPenguin_
4 hours agoSOLO Extraction. Looting & PVP
26 watching -
1:57:14
vivafrei
21 hours agoEp. 280: RFK Jr. Senate Hearing! Activist Fed Judges! Epstein Victims DEBACLE! & MORE! Viva & Barnes
78.1K90 -
LIVE
GritsGG
4 hours agoTop 250 Ranked Grind! Dubulars!🫡
59 watching -
5:31
WhaddoYouMeme
1 day ago $3.52 earned$8,000/hr Dating Coach Loses Everything (Sadia Kahn)
22.4K11 -
6:29:33
Ouhel
7 hours agoSunday | CoD 4 | CAMPAIGN PLAYTHROUGH | Nostalgia Kick
14.4K4 -
13:14
DEADBUGsays
1 day agoThe Murder of Veronica Kaye | Cold#11
18.3K4