+ 3

Como creo una entrada de usuario

17th Feb 2023, 10:39 PM
Lucy Maria Ek Chan
1 Odpowiedź
+ 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); } }
19th Feb 2023, 8:25 AM
Last
Last - avatar