Checking whether the entered number is an integer or not

 


import java.util.*;


public class first  {
public static void main(String[] args) {
System.out.println("enter n:");
    Scanner sc =new Scanner(System.in);
    System.out.println( sc.hasNextInt());
}
}

Comments