Follow me on Instagram
/ smart_engineer_youtube
00:10 using scanner class
05:08 string input
07:12 next() and nextLine()
10:04 printing output
12:07 print formatted output
For taking user input use Scanner class inside java.util package. we need to import the package in order to use the Scanner class.
Create object of scanner class and by using the object we can access methods of scanner class.
for integer input use method nextInt()
for double input use method nextDouble()
for long input use method nextLong()
similarly for different input use corresponding next method
for string input we can use next() and nextLine() method
next() will read only one token
nextLine() will read entire line
for output we can use
print() - which will print whatever is there in the bracket
println() - will print things inside bracket and cursor moves to next line
printf() - will give formatted output
% [flags] [width] [.precision] conversion-character
eg: %-10.2s
flag can be +-0,
width will print the total length
precision - up to how many letters or digits we need
conversion character - s for string, d for digit , t for date
java input output tutorial
java user input
how to give user input in java
java output
java output formatting
how to get formatted output in java
Auf dieser Seite können Sie das Online-Video java user input | java output | java output formatting mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Smart Engineer 28 Mai 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 614 Mal angesehen und es wurde von 7 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!