-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.java
More file actions
27 lines (25 loc) · 880 Bytes
/
Main.java
File metadata and controls
27 lines (25 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.yurii.salimov.lesson03.task09;
/**
* 3.9 Придумать свое исключение и написать соответствующий класс и использующий его код.
*
* @author Yuriy Salimov (yuriy.alex.salimov@gmail.com)
* @version 1.0
*/
public class Main {
public static void main(String[] args) {
try {
double[] numbers = {Math.PI, -Math.E};
for (double number : numbers) {
System.out.println("Sqrt(" + number + ") = " + Arithmetic.sqrt(number));
}
} catch (SqrtException ex) {
System.out.println(ex.getMessage());
} finally {
try {
System.out.println(Arithmetic.division(10, 0));
} catch (ZeroException ex) {
System.out.println(ex.getMessage());
}
}
}
}