public class Main {
public static void main(String[] args) {
/*
时代Java - nowjava.com
*/
Object chatServer = null;
try {
call("Hello, how are you?");
} catch (MyException e) {
System.out.println("Caught a connection unavailable Exception!");
}
disconnectChatServer(chatServer);
}
private static void disconnectChatServer(Object chatServer) {
/*
N o w J a v a . c o m - 时代Java 提 供
*/
throw new Myexception2("Chat server is empty");
}
private static void call(String chatMessage)
throws MyException {
throw new MyException("Can't find the chat server");
}
}
class MyException extends Exception {
MyException(String message) {
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。