As shown below:
import java.util.*; public class Main{public static void main(String args[]){Scanner cn = new Scanner(System.in);System.out.print("Please enter an integer:"); int data;if (cn.hasNextInt()){ data = cn.nextInt(); System.out.println("Out:"); System.out.println(data);} else{ System.out.println("There is a problem with the input....");}}}The above method to determine whether java hasNextInt is a number is all the content I have shared with you. I hope it can give you a reference and I hope you can support Wulin.com more.