我试图了解用户输入的类型是数字、字符还是字符串。我怎样才能完成评论中想要的任务?
public static void main(String[] args) {
Calculator calculator=null;
Scanner num = new Scanner(System.in);
System.out.println("press C to clear. press E to terminate. ");
while (true) {
String input = num.nextLine();
UserInputHandler.handleuserinput(input, calculator);
// if the input is a number do some thing.
//if the input is a character do some thing else.
}
}