java.util.InputMismatchException in java

In this Program i am going to do Exceeds the minimum range of Integer in Java.
     
Error Message:

Enter a Integer value
 -2147483649
Exception in thread "main" java.util.InputMismatchException: For input string: "-2147483649"
       at java.util.Scanner.nextInt(Scanner.java:2123)
       at java.util.Scanner.nextInt(Scanner.java:2076)
       at com.lib.IntergerMinRange.main(IntergerMinRange.java:11)


Error Description:

If you are going to Exceeds the minimum range of Integer we will get an InputMismatchException.

 package com.lib;

import java.util.Scanner;

public class IntergerMinRange {

       public static void main(String[] args)
       {
              Scanner scn = new Scanner(System.in);
              System.out.println("Enter a Integer value");
              int sc = scn.nextInt();
       }

}


Error Solution:

package com.lib;

import java.util.Scanner;

public class IntergerMinRange {

       public static void main(String[] args)
       {
              Scanner scn = new Scanner(System.in);
              System.out.println("Enter a Integer value");
              int sc = scn.nextInt();
       }

}


Output:
Enter a Integer value
-2147483648
Share this post :

Post a comment

Please share your valuable feedback and share this article in social media.

 
Support : Ranga Rajesh Kumar
Copyright © 2019. Error Solution - All Rights Reserved
Site Designed by Ranga Rajesh Kumar