+ 3
Como creo una entrada de usuario
1 Respuesta
+ 2
In Java, you can create user input by using the Scanner class to get user input from the console.
Example:
import java.util.Scanner;
public class UserInput {
public static void main(String[] args) {
// Create a scanner object
Scanner userInput = new Scanner(System.in);
// Show hint
System.out.println("Enter your name: ");
// Wait for the user to enter something
Line input = userInput.nextLine();
// Display username
System.out.println("You entered: " + input);
}
}