take in string input java code example
Example 1: java scanner
import java.util.Scanner;
Scanner myScanner = new Scanner(System.in);
String inputString = myScanner.nextLine();
boolean inputBoolean = myScanner.nextBoolean();
long inputLong = myScanner.nextLong();
Example 2: java get input
Scanner sc = new Scanner(System.in);
String s = sc.next();
int n = sc.nextInt();
double d = sc.nextDouble();
float f = sc.nextFloat();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
int c = br.read();