NegativeException.java
上传用户:yinzh02
上传日期:2021-05-28
资源大小:63k
文件大小:1k
- package myException;
- /**
- * If the num is an negative while it is supported to an positive,
- * the NegativeException is thrown.
- *
- * @version 1.0 09 March 2008
- * @author LR-Zhi
- */
- public class NegativeException extends Exception{
-
- private String msg;
-
- /**
- * Costructor, initialize the attribute "msg" with s.
- *
- * @param s Value to initialize "msg".
- */
- public NegativeException(String s){
- msg = s;
- }
-
- /**
- * Override toString Method.
- *
- * @return Formated error message output.
- */
- @Override
- public String toString(){
- return msg + " should be an Positive.";
- }
- }