Scanner scanner = new Scanner(System.in); System.out.print("Enter something: "); String input = scanner.nextLine();Scanner sc = new Scanner(System.in); String s = sc.next(); int n = sc.nextInt(); double d = sc.nextDouble(); float f = sc.nextFloat(); // more fast way BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); // read line int c = br.read(); // read single char//For continues reading a line import java.util.Scanner; Scanner in = new Scanner(System.in); while(in.hasNextLine()) { String line = in.nextLine(); System.out.println("Next line is is: " + line); } import java.util.Scanner; //... Scanner scan = new Scanner(System.in); String s = scan.next(); int i = scan.nextInt(); import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Sample { public static void main(String[] args) { BufferedReader datain = new BufferedReader(new InputStreamReader(System.in)); String name = ""; System.out.print("Enter your name:"); try { name = datain.readLine(); } catch (IOException e) { System.out.print("Error"); } System.out.println("Hello! " + name + "!"); } } import java.util.Scanner; public class UserInputExample { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // Prompt the user to enter an input System.out.print("Enter your name: "); String name = scanner.nextLine(); // Print the name entered by the user System.out.println("Hello, " + name + "!"); // Close the scanner scanner.close(); } }