资讯专栏INFORMATION COLUMN

GirlNotFoundException

weknow619 / 2782人阅读

经典梗 哈哈

public class Funny {

    public static void main(String[] args) {
        Coder me = new Coder("my name");
        getGirl(me);
    }

    private static GirlFriend getGirl(Object boy) {
        return new GirlFriend(boy);
    }

    private static class Coder {
        Coder(String name) {
        }
    }

    private static class GirlFriend {
        GirlFriend(Object boy) {
            if (boy instanceof Coder) {
                throw new GirlNotFoundException("Not possible for you XD");
            } else {
                System.out.println("Found");
            }
        }
    }

    private static class GirlNotFoundException extends RuntimeException {
        GirlNotFoundException(String msg) {
            super(msg);
        }
    }

}

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/66371.html

相关文章

发表评论

0条评论

最新活动
阅读需要支付1元查看
<