Skip to content

Commit 83ded37

Browse files
committed
Strict Math sample
1 parent f9271f1 commit 83ded37

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.winterbe.java8.samples.misc;
2+
3+
/**
4+
* @author Benjamin Winterberg
5+
*/
6+
public class StrictMath1 {
7+
8+
public static void main(String[] args) {
9+
System.out.println(Integer.MAX_VALUE + 1);
10+
11+
try {
12+
Math.addExact(Integer.MAX_VALUE, 1);
13+
}
14+
catch (ArithmeticException e) {
15+
System.out.println(e.getMessage());
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)