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().
-
1:57:43
Steven Crowder
4 hours agoFailed Hit Job: Another Trump Media Hoax Exposed
274K240 -
56:36
The Rubin Report
3 hours agoFox Hosts Stunned by Piers Morgan’s Dark Prediction for NYC Under Zohran Mamdan
25.4K39 -
LIVE
XDDX_HiTower
2 hours ago $0.61 earnedGRAY ZONE DEVLOG FOR .3.5 UPDATE!!! [RGMT CONTENT Mgr. | RGMT GL | GZW CL]
83 watching -
LIVE
LFA TV
17 hours agoLIVE & BREAKING NEWS! | TUESDAY 11/4/25
2,421 watching -
DVR
The Shannon Joy Show
3 hours agoICE Brutality In Evanston, Illinois Sparks New Outrage * GOP Seeks New FISA Re-Authorization * Are Tucker Carlson & Nick Fuentes Feds?
15.4K4 -
1:41:24
The Mel K Show
3 hours agoA Republic if You Can Keep It-Americans Must Choose 11-04-25
20.8K1 -
35:49
Grant Stinchfield
2 hours ago $0.98 earnedThe Mind Meltdown: Are COVID Shots Fueling America’s Cognitive Collapse?
13.5K3 -
1:00:46
VINCE
5 hours agoThe Proof Is In The Emails | Episode 161 - 11/04/25
171K168 -
2:12:22
Benny Johnson
4 hours ago🚨Trump Releases ALL Evidence Against James Comey in Nuclear Legal BOMBSHELL! It's DARK, US in SHOCK
96.4K41 -
2:04:05
Badlands Media
12 hours agoBadlands Daily: November 4, 2025
69.3K14