Skip to content

Instantly share code, notes, and snippets.

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