OutOfRangException.java
上传用户:yinzh02
上传日期:2021-05-28
资源大小:63k
文件大小:1k
- package myException;
- /**
- * If the index is out of existing rank's rang,
- * the OutOfRangException is thrown.
- *
- * @version 1.0 09 March 2008
- * @author LR-Zhi
- */
- public class OutOfRangException extends Exception {
-
- private int nRank;
-
- /**
- * Costructor, initialize the attribute "nRank" with n.
- *
- * @param s Value to initialize "nRank".
- */
- public OutOfRangException(int n){
- nRank = n;
- }
-
- /**
- * Override toString Method.
- *
- * @return Formated error message output.
- */
- @Override
- public String toString(){
- return "The rank should between 0 and " + nRank + ".";
- }
- }