This video shows you how to get user input and output it to the console within Java! Below is the source code for reference! If you have any questions, leave a comment and I'll get back to you!
// ---------------- SOURCE CODE ----------------- //
import java.util.Scanner;
public class UserInput {
public static void main(String[] args) {
// Create Scanner Object
Scanner scannerObject = new Scanner(System.in);
// Asking user for their user name
System.out.println("Enter name:" );
// Holding user's input
String userName = scannerObject.nextLine();
// Outputting user's name
System.out.println("Your name is " + userName);
}
}
TAGS
#Programming #Coding #Tutorial #ScannerObject #JavaTutorial #Java #backend #softwareengineer
On this page of the site you can watch the video online How to capture user input in JAVA | Scanner Object Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Bakr Kode 25 December 2023, share the link with friends and acquaintances, this video has already been watched 48 times on youtube and it was liked by 4 viewers. Enjoy your viewing!