i would want to know how to take char input with spaces in Java?

You can try reader.ReadLine() to read the full line of user input and do what you want later in the code. For example put all chars into an array.

Scanner reader = new Scanner(System.in);
String input = reader.ReadLine();
char[] c = input.toCharArray();

Leave a Comment