Solved

What does this class do in Java?

Posted on 2007-03-28
7
179 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
throw exception 21 68
ejb on wildfly 5 47
Java: anonymous class 4 38
Tagging and Merging on Branch 1 43
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

733 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