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().
-
LIVE
Film Threat
18 hours agoVERSUS: SPINAL TAP II + FALL PREVIEW | Film Threat Versus
28 watching -
LIVE
The Nunn Report - w/ Dan Nunn
1 hour ago[Ep 748] Revival - The God Effect Through Charlie | You’re Fired! | Iryna Zarutska Update
132 watching -
LIVE
Rallied
2 hours ago $0.03 earnedShotty Boys Warzone Challenges
128 watching -
LIVE
Right Side Broadcasting Network
6 hours agoLIVE: President Trump Signs a Presidential Memorandum - 9/15/25
3,138 watching -
1:29:01
Sean Unpaved
3 hours agoTurf Tumbles & Triumphs: Burrow's Setback, Chiefs' Crumble, Irish Iced, & Kelly's 3-0
34.2K -
34:27
The Quiet Part
5 hours ago $0.21 earnedCanada DIDN'T EVEN TRY!
4.95K4 -
LIVE
SportsPicks
5 hours agoCrick's Corner: Episode 80
40 watching -
2:06:51
The Charlie Kirk Show
4 hours agoVice President JD Vance Remembers Charlie Kirk | Miller, Tucker, RFK Jr., Wiles, Leavitt | 9.15.25
1.39M1.22K -
LIVE
Major League Fishing
5 days agoLIVE! - Fishing Clash Team Series: Heritage Cup - Day 2
312 watching -
1:08:54
Simply Bitcoin
4 hours ago $0.82 earnedNEW REPORT SUGGESTS THE BITCOIN SUPPLY SHOCK IS ACCELERATING?! | EP 1332
21.2K1