Define an exception type in Java
class SimpleException extends Exception { }
class RecommendExc extends RuntimeException {
//recommended constructors
public RecommendExc () { }
public RecommendExc(String message) {
super(message);
}
//... any other members
}
throw new SimpleException();
throw new RecommendExc("exeption");
- Log in to post comments