Skip to content

Commit debb8dd

Browse files
fixed typo
1 parent 283ad78 commit debb8dd

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/com/examplehub/maths/AbsoluteValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class AbsoluteValue {
44

55
/**
6-
* Returns the absolute value of a {@code long} value.
6+
* Returns the absolute value of a {@code int} value.
77
*
88
* @param a the argument whose absolute value is to be determined.
99
* @return the absolute value of the argument.

src/main/java/com/examplehub/maths/CountDigitsRecursion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class CountDigitsRecursion {
55
/**
66
* Count the number of digits of a number using recursion.
77
*
8-
* @param number the number to counted.
8+
* @param number the number to be counted.
99
* @return the number of digits.
1010
*/
1111
public static int countDigits(int number) {

src/main/java/com/examplehub/maths/Divide.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ public class Divide {
88
* @param a the first number.
99
* @param b the second number.
1010
* @return divide value of two integer numbers.
11+
* @throws ArithmeticException if divisor is zero.
1112
*/
1213
public static int divide(int a, int b) {
14+
if (b == 0) {
15+
throw new ArithmeticException("divide by zero");
16+
}
1317
return a / b;
1418
}
1519

@@ -19,6 +23,7 @@ public static int divide(int a, int b) {
1923
* @param a the first number.
2024
* @param b the second number.
2125
* @return divide value of two double numbers.
26+
* @throws ArithmeticException if divisor is zero.
2227
*/
2328
public static double divide(double a, double b) {
2429
if (b == 0.0) {

0 commit comments

Comments
 (0)