Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Teste {
- public void doSomething() {
- System.out.println("Run");
- throw new RuntimeException("Exception handling");
- }
- public void doConsumer(Consumer<Teste> consumer) {
- consumer.accept(new Teste());
- }
- public void doRunnable(Runnable func) {
- func.run();
- }
- public void fromInside() {
- doRunnable(this::doSomething);
- doConsumer(Teste::doSomething);
- }
- public static void main(String[] args) {
- Teste t = new Teste();
- t.fromInside();
- }
- }
Add Comment
Please, Sign In to add comment