I have a class
class Foo {
static void bar() throws InterruptedException {
// do something
Thread.sleep(1000);
}
static void baz(int a, int b, int c) throws InterruptedException {
// do something
Thread.sleep(1000);
}
}
Then I simply run it in my main
class Main {
public static void main() {
new Thread(Foo::bar).start();
new Thread(() -> Foo.baz(1, 2, 3)).start();
new Thread(() -> Foo.baz(1, 2, 3)).start();
}
}
I don't care about the InterruptedException
. I tried to write a try-catch block, but, obviously, the exception is not caught. Java doesn't allow me to make main() throw either.
How can I simply ignore this exception I don't care at all about? I don't want to write a try-catch block in every thread constructor.
The exception should be thrown at times, but in this specific case I don't care about it.