0
Can users be asked to input anything using solo code playground??
Java
2 Respuestas
+ 8
You can take inputs, but you can't change the input message or output anything before the input prompt pops up. And the user will have to input everything in that one input prompt, values separated by line break.
Example:
https://code.sololearn.com/cxdPW83QP6Mm/?ref=app
+ 4
Yes.
The most common way is to use a Scanner.
import java.util.Scanner;
// top of program
class Program{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
// Creating scanner object
// Using System.in inputStream
String input = sc.nextLine();
// takes the whole line the user enters
}
}
Scanners have many other methods too, you can find them all here:
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html