Skip to content

Instantly share code, notes, and snippets.

@msbaek
Created February 23, 2025 07:15
Show Gist options
  • Save msbaek/8b21ab27e7df17fbbcd1338588af9cf3 to your computer and use it in GitHub Desktop.
Save msbaek/8b21ab27e7df17fbbcd1338588af9cf3 to your computer and use it in GitHub Desktop.
public class Divider {
public int divide(int dividend, int divisor) {
if (divisor != null) {
if(dividend != null) {
if (divisor != 0) {
return dividend / divisor;
} else {
throw new IllegalArgumentException("divisor must not be 0");
}
} else {
throw new IllegalArgumentException("dividend must not be null");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment