+ 1
Text input in java
I have been taking notes and I remember that I've seen it done but I can't remember or find how to make a text input for a variable.
4 Respostas
+ 12
If you mean String, then use the following way:
Scanner input = new Scanner (System.in);
String message = input.nextLine();
+ 6
import java.util.Scanner;
public class Test{
public static void main(String args[]){
String Text;
Scanner stdin = new Scanner(System.in);
Text= stdin.nextLine();
System.out.println(Text);
}
}
+ 2
import scanner then write the following code
Scanner s =new Scanner(System.in);
String a=s.nextLine();
0
import java.util.Scanner
Then,
Scanner variable = new Scanner(System.in);
int variable_name=variable.nextInt();
double variable_name=variable.nextDouble();
String variable_name=variable.nextLine();