daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Teste {
  2.  
  3.     public void doSomething() {
  4.         System.out.println("Run");
  5.         throw new RuntimeException("Exception handling");
  6.     }
  7.  
  8.     public void doConsumer(Consumer<Teste> consumer) {
  9.         consumer.accept(new Teste());
  10.     }
  11.  
  12.     public void doRunnable(Runnable func) {
  13.         func.run();
  14.     }
  15.  
  16.     public void fromInside() {
  17.         doRunnable(this::doSomething);
  18.         doConsumer(Teste::doSomething);
  19.     }
  20.  
  21.     public static void main(String[] args) {
  22.         Teste t = new Teste();
  23.         t.fromInside();
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top