Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.ex21;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- public class Main4 {
- // метод который выбрасывает исключение
- // используем ключевое слово throws
- public static void test() throws Exception{
- System.out.println("test!!!");
- }
- public static void main(String[] args) {
- try {
- //
- test();
- } catch (Exception ex) {
- ex.printStackTrace();
- System.out.println("ex.message=" + ex.getMessage());
- }
- System.out.println("OK");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement