Java lee una línea de texto usando escáner
import java.util.Scanner;
class Main {
public static void main(String[] args) {
// creates an object of Scanner
Scanner input = new Scanner(System.in);
System.out.print("Enter your name: ");
// takes input from the keyboard
String name = input.nextLine();
// prints the name
System.out.println("My name is " + name);
// closes the scanner
input.close();
}
}
SAMER SAEID