0
Scanner
How do I take a user input of a character.Please help
2 odpowiedzi
+ 1
import java.util.*;
public class character
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
char alpha = in.next().charAt(0);
//Don't use next line...
}
}
0
You can do the following:
Scanner in = new Scanner(System.in);
char yourChar = in.nextLine().charAt(0);