当前位置: 代码迷 >> Java面试 >> 随手写解决方法
  详细解决方案

随手写解决方法

热度:27   发布时间:2016-04-17 19:23:58.0
随手写


Java code
public interface People{    public void freedom();    public void democratic();    public void democratic(Country parade);    public void likeGovernment(int like);}


Java code
public final class Chinese implements  People{    public static final  Chinese chinese=new Chinese();        private Chinese() {};        public void freedom()    {                throw new UnsupportedOperationException();    }    public void democratic()    {                throw new UnsupportedOperationException();    }        public void likeGovernment(int like)    {                if(like<100) {            throw new IllegalArgumentException("only 100 support");        }    }    public void democratic(Country parade)    {                if(parade!=Country.CHINA&&parade!=Country.NORTH_KOREA) {            if(new Random().nextBoolean()) {//                justdo();            }else {                throw new IllegalStateException();            }        }else {            throw new UnsupportedOperationException();        }    }            @Override    public String toString()    {        return "我是中国人我自豪";    }    }


------解决方案--------------------
LZ好NB啊\(^o^)/~
------解决方案--------------------
...
  相关解决方案