Check out example codes for "java read string input". It will help you in understanding the concepts better.

Code Example 1

import java.util.Scanner;
 
public class YourClass {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String inputString = scanner.nextLine();
        System.out.println("Your string: " + inputString);
    }
}

Learn ReactJs, React Native from akashmittal.com