經典梗 哈哈
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); } } }
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/66371.html
閱讀 1679·2021-11-19 09:40
閱讀 2934·2021-09-24 10:27
閱讀 3221·2021-09-02 15:15
閱讀 1882·2019-08-30 15:54
閱讀 1206·2019-08-30 15:54
閱讀 1375·2019-08-30 13:12
閱讀 637·2019-08-28 18:05
閱讀 2803·2019-08-27 10:53