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...

Referring to the accompanying figure, which of the following is pointed to by callout B?

A. Reading panel B. Control panel C. Inbox list D. Compose message panel

Computer Science & Information Technology

An example of where you would use the "draw/flip" would be when you are drawing a peppermill.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The most common way for a virus to spread is by __________

a. Use of your email contacts b. Scanning your computer for network connections and copying itself to other machines on the network c. Locating Linux machines d. None of the above

Computer Science & Information Technology

In Linux, what command can be used for viewing and setting wireless interface parameters?

a. ifconfig b. iwconfig c. wlanconf d. wifid

Computer Science & Information Technology