fork download
  1. import java.util.Arrays;
  2. import java.util.List;
  3.  
  4. class BeautifulGirlShouldNotDefecate extends Exception {}
  5.  
  6. class Main {
  7. public static void main(String[] args) throws Exception {
  8. List<Human> humans = Arrays.asList(new Human(), new BeautifulGirl(), new Human());
  9. try {
  10. for (Human human : humans) {
  11. human.eat();
  12. human.defecate();
  13. }
  14. } catch (Exception e) {
  15. System.out.println("美少女はうんこしません!");
  16. }
  17. }
  18. }
  19.  
  20. class Human {
  21. public void eat() {
  22. System.out.println("ぱくぱく");
  23. }
  24. public void defecate() throws BeautifulGirlShouldNotDefecate {
  25. System.out.println("ぶりぶりー");
  26. }
  27. }
  28.  
  29. class BeautifulGirl extends Human {
  30. @Override
  31. public final void defecate() throws BeautifulGirlShouldNotDefecate {
  32. throw new BeautifulGirlShouldNotDefecate();
  33. }
  34. }
  35. /* end */
  36.  
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
ぱくぱく
ぶりぶりー
ぱくぱく
美少女はうんこしません!