How to capture user input in JAVA | Scanner Object Tutorial

Pubblicato il: 25 dicembre 2023
sul canale di: 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


In questa pagina del sito puoi guardare il video online How to capture user input in JAVA | Scanner Object Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Bakr Kode 25 dicembre 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 48 volte e gli è piaciuto 4 spettatori. Buona visione!