others.java

来自「java的23种设计模式」· Java 代码 · 共 25 行

JAVA
25
字号
/**
 *  The end of the chain
 *  The resposibility of Others is handle exeception 
 */
import java.io.*;

public class Others implements Chain {
    private Chain nextChain = null;
    private String responsibility = "";
    
    public Others() {
    }
    public void addChain(Chain c) {
        nextChain = c;
    }
    
    public Chain getChain() {
        return nextChain;
    }
    
    public void sendToChain(String mesg) {
            System.out.println("No one can handle -->  " + mesg);
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?