@FunctionalInterface @API(status=STABLE, since="5.0") public interface Executable
Executable
is a functional interface that can be used to
implement any generic block of code that potentially throws a
Throwable
.
The Executable
interface is similar to Runnable
,
except that an Executable
can throw any kind of exception.
Throwable
instead of Exception
Although Java applications typically throw exceptions that are instances
of Exception
, RuntimeException
,
Error
, or AssertionError
(in testing
scenarios), there may be use cases where an Executable
needs to
explicitly throw a Throwable
. In order to support such specialized
use cases, execute()
is declared to throw Throwable
.
Modifier and Type | Method and Description |
---|---|
void |
execute() |