Solved

What does this class do in Java?

Posted on 2007-03-28
7
180 Views
Last Modified: 2010-03-31
What does this class do in Java? What is an exception in Java?
package org.muos.management.managementSupport;

/**
 *      The wrapper exeption which wrap the underline exceptions.
 *
 */
public class ManagementSupportException extends Exception {
      private String message;

      public ManagementSupportException(String message) {
            this.message = message;
      }
}
0
Comment
Question by:yankeebushsoftware
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 8

Accepted Solution

by:
mnrz earned 300 total points
ID: 18813943
it does nothing, it is just an Exception and can be thrown by code like this:

throw new ManagementSupportException();
0
 
LVL 8

Assisted Solution

by:mnrz
mnrz earned 300 total points
ID: 18813947
Although you may use "throw new Exception()" but this is much clear and better to categorize your exceptions
0
 

Author Comment

by:yankeebushsoftware
ID: 18813950
What's an exception?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 10

Assisted Solution

by:Jaax
Jaax earned 100 total points
ID: 18813966
This class serves as your application specific exception extended from the java's Exception class
By using a customized exception class for your application, you can add more features to the class whilst benefitting from those already present in the exception class. This reduces coding and maintainability - the benefits of inheritance.
It is like buying a new car and modifying it to a certain extent to suit your taste and style while maintaing the engine and transimission in tact.

The Exception class serves to indicate any abnormality the program encounters during the course of its execution. By throwing an exception the cause and nature of the problem is reported to the calling methods. It helps to diagnose the problem. Different kinds of exception  can point to different kinds of exceptional conditions or abnormalities.
0
 
LVL 8

Assisted Solution

by:mnrz
mnrz earned 300 total points
ID: 18813987
consider this code:

int i = 0;
int j = 10;

j = j / i; //(1)

(1) this line throws an exception (error) because no number can divided into 0.

the thrown exception has a message like "Divide by Zero"

so you can catch this error by a try/catch block and display the message of error:

try{
    j = j / i;
}catch(Exception x){
    System.out.println(x.getMessage());
}

but you can define a new exception , say, DivideByZeroException like the code you mentioned

now:

try{
    j = j / i;
}catch(DivideByZeroException x){
    System.out.println(x.getMessage());
}


this is much better than former code because any programmer by a quick look at the code will understand what error might happen during this code.
0
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 100 total points
ID: 18814118
0
 
LVL 37

Expert Comment

by:zzynx
ID: 18814604
Thanx 4 axxepting
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question