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
Total Horse Channel
11 hours ago2025 Reno Snaffle Bit Futurity | Friday
17 watching -
26:40
Rethinking the Dollar
1 hour agoPeter Schiff: "Trump's Economy WORSE Than Biden" | Morning Check-In: Let's Talk...
151 -
LIVE
Badlands Media
7 hours agoBadlands Daily: September 5, 2025
4,219 watching -
24:00
Bearing
3 hours agoThe Week LIBERALS Thought TRUMP DIED 💥 (And Went INSANE) 🤣
3.56K11 -
LIVE
GritsGG
1 hour agoWin Streaking!! 🫡!
39 watching -
1:41:36
Dear America
2 hours agoWelcome To The Dept Of WAR! RFK DESTROYS The CDC! + Should Trans Own Guns?!
71.1K51 -
Matt Kohrs
10 hours agoStocks Hit Record High, Breaking Jobs News || Live Day Trading & Analysis
12.3K -
LIVE
Wendy Bell Radio
6 hours agoSchilling For Big Pharma
7,260 watching -
1:09:42
Crypto Power Hour
3 hours ago $0.31 earnedMemecoin Masterclass
8.64K5 -
LIVE
Major League Fishing
1 day agoLIVE Tackle Warehouse Invitationals Championship, Day 1
677 watching