blok try catch
package pl.am.errors.lesson6;
import java.io.IOException;
public class CatchException {
public static void main(String[] args) {
System.out.println("przed try");
try {
System.out.println("blok try");
if (false) {
throw new IOException("Testowy wyjątek");
}
System.out.println("Koniec bloku try");
} catch (Exception exception) {
System.out.println(exception.getMessage());
}
System.out.println("za blokiem try catch");
}
}