public class NextIntMethod { public static void main(String[] args) { try { Scanner sc = new Scanner(System.in); System.out.println("Enter numeric value : "); int numVal = sc.nextInt(); System.out.println("Enter country name : " + numVal); sc.close(); }catch (InputMismatchException e) { System.out.println("Wrong value"); e.printStackTrace(); } } }
No comments:
Post a Comment