- 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&¶de!=Country.NORTH_KOREA) { if(new Random().nextBoolean()) {// justdo(); }else { throw new IllegalStateException(); } }else { throw new UnsupportedOperationException(); } } @Override public String toString() { return "我是中国人我自豪"; } }
------解决方案--------------------
LZ好NB啊\(^o^)/~
------解决方案--------------------
...