Well, it is not mandatory to use the scanner class. If you want to take input from the user and check the value whether it is an integer or not you need a scanner class. Otherwise, you can define a variable and check it for an integer number or not! As per your question, I guess you are willing to use a Scanner class to it. let’s do it by using a Scanner class.
Scanner sc = new Scanner(System.in);
System.out.println("Enter an input here: ");
System.out.println("Given input is an integer");
String str = scanner.nextLine();
System.out.println("Given input is a String");
System.out.println("Given input is a Char");
I’ve added all the three processes to check the input type in a single program. The first block will chek for integers and then for string and lastly for chars.