mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 00:20:54 +07:00
`throw e` won't fix the compilation error, comment - is not really better than empty catch block. GitOrigin-RevId: ea002c332900b032392e766f3dd13fe3258ad49c
26 lines
518 B
Java
26 lines
518 B
Java
import java.io.IOException;
|
|
import java.util.function.Consumer;
|
|
|
|
class Action {
|
|
public void acting(String s) throws IOException {
|
|
System.out.println(s);
|
|
}
|
|
}
|
|
|
|
|
|
class Client {
|
|
public static void consumer(String val, Consumer<String> func) {
|
|
func.accept(val);
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
Action a = new Action();
|
|
consumer("hello", (s) -> {
|
|
try {
|
|
a.acting(s);
|
|
} catch (IOException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
});
|
|
}
|
|
} |