Exception Lambda Demo
Wed May 29 2024 19:20:45 GMT+0000 (Coordinated Universal Time)
Saved by
@exam123
interface MyOperation {
void performOperation() throws Exception;
}
public class ExceptionLambdaDemo {
public static void main(String[] args) {
MyOperation operation = () -> {
throw new Exception("Exception thrown from lambda expression");
};
try {
operation.performOperation();
} catch (Exception e) {
System.out.println("Exception caught: " + e.getMessage());
}
}
}
content_copyCOPY
Comments