Solved

What does this class do in Java?

Posted on 2007-03-28
7
170 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
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now