经典梗 哈哈
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
阅读 1921·2021-11-19 09:40
阅读 3074·2021-09-24 10:27
阅读 3388·2021-09-02 15:15
阅读 2022·2019-08-30 15:54
阅读 1384·2019-08-30 15:54
阅读 1497·2019-08-30 13:12
阅读 775·2019-08-28 18:05
阅读 2963·2019-08-27 10:53