Question fetched from API endpoint api/expression/12/1
{
"result": [
{
"message": "com.example.mistakes.expression._12_UnusedObjects.Ex1",
"before": " void before(int value) {\n if (value < 0) {\n new IllegalArgumentException(\"Value is negative\");\n }\n",
"after": " void after(int value) throws IllegalArgumentException {\n if (value < 0) {\n throw new IllegalArgumentException(\"Value is negative\");\n }\n",
"chapter": 2,
"id": "2_12_1",
"className": "Ex1",
"path": "file:///home/runner/work/100_java_mistakes/100_java_mistakes/back/src/main/java/com/example/mistakes/expression/_12_UnusedObjects.java"
}
],
"length": 1
}
void before(int value) {
if (value < 0) {
new IllegalArgumentException("Value is negative");
}
void after(int value) throws IllegalArgumentException {
if (value < 0) {
throw new IllegalArgumentException("Value is negative");
}