Java 实例 - 自定义异常
Java 教程
· 2019-02-11 11:29:21
以下实例演示了通过继承 Exception 来实现自定义异常:
TestInput.java 文件
class WrongInputException extends Exception { // 自定义的类
WrongInputException(String s) {
super(s);
}
}
class Input {
void method() throws WrongInputException {
throw new WrongInputException("Wrong input"); // 抛出自定义的类
}
}
class TestInput {
public static void main(String[] args){
try {
new Input().method();
}
catch(WrongInputException wie) {
System.out.println(wie.getMessage());
}
}
}
以上代码运行输出结果为:
Wrong input
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
零成本实现Web性能测试
温素剑 / 电子工业出版社 / 2012-2 / 59.00元
《零成本实现Web性能测试:基于Apache JMeter》是一本关于Web性能测试的实战书籍,读者朋友们在认真阅读完《零成本实现Web性能测试:基于Apache JMeter》后,相信能够将所学知识应用到生产实践中。《零成本实现Web性能测试:基于Apache JMeter》首先介绍基础的性能测试理论,接着详细介绍如何使用JMeter完成各种类型的性能测试。实战章节中作者以测试某大型保险公司电话......一起来看看 《零成本实现Web性能测试》 这本书的介绍吧!