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 7976883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:02:03+00:00 2026-06-04T09:02:03+00:00

I am facing difficulty to handle my own exception from Anonymous Inner class which

  • 0

I am facing difficulty to handle my own exception from Anonymous Inner class which is a part of Action listener.

Given below is My own Exception:

class Register extends Exception
{
    String Error;
    public Register() 
    {
    Error = new String("Register Exception");
}
}

Here the method given below is in another class in mouse listener.

public void Gui() throws Register
{
    jButton.addMouseListener(new MouseAdapter() 
    {
        public void mouseClicked(MouseEvent e) 
        {
                throw new Register();    //Unhandled exception type Register
         }          
     });
     throw new Register();   // This works fine.
}

And I am able to work if I throw the exception in method.

  • 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-04T09:02:04+00:00Added an answer on June 4, 2026 at 9:02 am

    There are two types of exceptions in Java: Checked (i.e., you are forced to catch them) and unchecked (you are not forced to catch them). Subclasses of RuntimeException and Error are unchecked while subclasses of other exceptions are considered checked. To mitigate the problem in your code change the line

    class Register extends Exception
    

    to

    class Register extends RuntimeException
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing difficulty in writing a generic class in java whose generic members
I am facing an difficulty in decoding an json string. Below is my json
I am facing extreme difficulty digesting the concepts of assembly language programming. I am
Im facing an issue with The following: public class Person { private long id;
I have a class TestService which implements two service contracts called IService1 and IService2
I am facing a situation at which my development team would like to re-organize
I am trying to create Jqplot bar charts and facing difficulty in creating multidimensional
I am trying to create Jqplot bar charts and facing difficulty in creating multidimensional
i am facing problem whenever i am running my wsdl2java the ExtensionMapper class is
I am new to JUnit and facing difficulty in writing JUnit. I have an

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.