Problem description
Many students, like me, have just started to get into Java, and may suddenly change from C to Java, and some are as helpless as me. How can I get the strings entered by the user!
The columns shown below:
import Java.util.Scanner;//Import the input class public static void main(String[] args) {//Create the input object Scanner sc=new Scanner(System.in);//Get the string entered by the user String str=null;System.out.print("Please enter any character:");str=sc.nextLine();System.out.println("The character you entered is:"+str);}The above java method to obtain string input by users is all the content shared by the editor. I hope it can give you a reference and I hope you can support Wulin.com more.