+ 2
how to check if the input(with Scanner method) is number or alphabet in java
I need an example
7 ответов
+ 4
To get integer input
Use nextInt() method and for alphabet use next() method
+ 2
You can use wrapper class character
Character.isDigit(parameters)
It will return true if input is a digit otherwise it will return false
+ 1
What I want here is, if the user input an alphabet, to print "please use only numbers". If the user inputs a number, to execute a code.
+ 1
Thanks piyush 🏆
+ 1
Thank you Martin🎖️