+ 1
Java user input is just by scanner?
I'm learning java now and I'm a bit confused about the user input, in c i'd use scanf, but with java the best option I found was the scanner, is there other options? https://code.sololearn.com/cmsl91jVHuNN/?ref=app
6 ответов
+ 9
/*or this*/
import java.util.*;
public class Program
{
public static void main(String[] args) {
int n = new Scanner(System.in).nextInt();
System.out.printf("Digite Aqui um Numero: %d",n);
}
}
+ 8
/*you could do this */
import java.util.*;
public class Program
{
public static void main(String[] args) {
System.out.println("Digite Aqui um Numero: "+new Scanner(System.in).nextInt());
}
}
+ 6
Joao Luiz de Castro JOptionPane class is used to provide standard dialog boxes such as message dialog box, confirm dialog box and input dialog box. These dialog boxes are used to display information or get input from the user. See how to implement it and more related to it.
https://www.javatpoint.com/java-joptionpane