Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.util.Optional;
  2.  
  3. public class A {
  4.  
  5. public static void main(String[] args) {
  6. Optional<String> aaaOptinal = Optional.ofNullable("aaa");
  7. aaaOptinal.ifPresent(aaa -> {
  8. try {
  9. hoge();
  10. } catch (HogeExeption e) {
  11. String hoge = null;
  12. hoge.length();
  13. } catch (Throwable e) {
  14. System.out.println("ここにはこない!");
  15. }
  16. });
  17.  
  18. }
  19.  
  20. public static void hoge() throws HogeExeption {
  21. throw new HogeExeption();
  22.  
  23. }
  24.  
  25. }
  26.  
  27.  
  28. public class HogeExeption extends Exception {
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement