How to capture user input in JAVA | Scanner Object Tutorial

Publicado em: 25 Dezembro 2023
no canal de: Bakr Kode
48
4

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


Nesta página do site você pode assistir ao vídeo on-line How to capture user input in JAVA | Scanner Object Tutorial duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Bakr Kode 25 Dezembro 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 48 vezes e gostou 4 espectadores. Boa visualização!