Define an exception class called NegativeNumberException.

The class should have a constructor
with no parameters. If an exception is thrown with this zero-argument constructor, getMessage
should return “Negative Number Not Allowed!” The class should also have a constructor with a
single parameter of type String. If an exception is thrown with this constructor, then getMessage
returns the value that was used as an argument to the constructor.

```
public class NegativeNumberException extends Exception
{
public NegativeNumberException()
{
super("Negative Number Detected!");
}

public NegativeNumberException(String message)
{
super(message);
}
}

```

Computer Science & Information Technology

You might also like to view...

When you use the ____________ in a Select statement, only the rows that meet the search criteria are returned.

a. Ask keyword b. Where clause c. ? operator d. Find expression

Computer Science & Information Technology

____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts.

A. Text tables B. Truth tables C. Results tables D. Yes/No tables

Computer Science & Information Technology