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().
-
57:40
MattMorseTV
8 hours ago $10.91 earned🔴Trump just SHATTERED the RECORD.🔴
54.2K90 -
43:39
WickedVirtue
5 hours agoLate Night Spooky Plays
37K2 -
2:04:02
Glenn Greenwald
8 hours agoTrump and Rubio Apply Panama Regime Change Playbook to Venezuela; Michael Tracey is Kicked-Out of Epstein Press Conference; RFK Senate Hearing | SYSTEM UPDATE #508
111K138 -
58:36
Total Horse Channel
10 hours ago2025 CSI3* A Coruña Porsche - Grand Prix
28.3K -
2:10:32
megimu32
6 hours agoOTS: Mighty Morphin Power Rangers & the 90s Movie That Defined a Generation
25.3K12 -
1:14:53
Badlands Media
21 hours agoTHE SITREP Ep. 128: Gun Rights, Sleep Paralysis, and Venezuela Cartel Strikes
44.5K11 -
2:44:56
BubbaSZN
6 hours ago🔴 LIVE - FORTNITE WITH NEW KEYBOARD
16.4K1 -
2:17:29
Mally_Mouse
7 hours agoThrowback Thursday! Let's Play: Cuphead
21.7K1 -
5:38:23
StevieTLIVE
7 hours agoWarzone HYPE Duos with GloryJean
14K1 -
1:05:11
Donald Trump Jr.
9 hours agoBuilding the Future with American Bitcoin, Plus Eric's Triggered Debut! | TRIGGERED Ep.272
121K57