Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:37:19+00:00 2026-06-06T17:37:19+00:00

I am receiving a compile time error saying: No exception of type InputMismatchException can

  • 0

I am receiving a compile time error saying:

No exception of type InputMismatchException can be thrown; an exception type must be a subclass of Throwable InputMismatchException.java

As far as I’m aware InputMismatchException is an exception thrown by the Scanner when it receives invalid input, why then is this error preventing me from compiling?

import java.util.*;
public class InputMismatchException
{
public static void main(String[] args)
{
    boolean continueInput = true;
    Scanner input = new Scanner(System.in);
    do
    {
        try
        {
            System.out.println("Enter an integer: ");
            int num = input.nextInt();
            System.out.println("You entered: " + num);
            continueInput = false;
        }
        catch (InputMismatchException e) //This is where the error occurs.
        {
            System.out.println("Enter an integer!");
            input.nextLine();
        }
    }while(continueInput);
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:37:20+00:00Added an answer on June 6, 2026 at 5:37 pm

    Try using a different name for your class. You’re confusing the compiler by having a class named InputMismatchException when that is already the name of an exception class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am receiving the following compile time error when attempting to extend the SimpleButton
I receiving a undefined reference error when try to compile an c++ program. I'm
I keep receiving this error... [2012-06-14 11:54:50,072: ERROR/MainProcess] Hard time limit (300s) exceeded for
Im receiving this error when trying to compile my code. $ g++ -o BangBangControlTest
I'm receiving the infamous undefined reference error when trying to compile & link several
I'm receiving a compile error on the following line of code: Dim oXL As
This is the error I am receiving, org.apache.jasper.JasperException: Unable to compile class for JSP:
I am receiving a parse error which is this: Parse error: syntax error, unexpected
I'm receiving an unhandled exception while debugging, and the program stops executing. The debugger
I am receiving Invalid Index COM exception when calling Excel.AddIns.Item[0] . Excel.AddIns.Count works all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.