Question fetched from API endpoint api/expression/2/1
{
"result": [
{
"message": "com.example.mistakes.expression._02_MissingParentheses.Ex1",
"before": " boolean before(int index, String str) {\n return index >= 0\n && str.charAt(index) == ' '\n || str.charAt(index) == '\\t';\n }\n",
"after": " boolean after(int index, String str) {\n return index >= 0\n && (str.charAt(index) == ' ' || str.charAt(index) == '\\t');\n }\n",
"chapter": 2,
"id": "2_02_1",
"className": "Ex1",
"path": "file:///home/runner/work/100_java_mistakes/100_java_mistakes/back/src/main/java/com/example/mistakes/expression/_02_MissingParentheses.java"
}
],
"length": 1
}
boolean before(int index, String str) {
return index >= 0
&& str.charAt(index) == ' '
|| str.charAt(index) == '\t';
}
boolean after(int index, String str) {
return index >= 0
&& (str.charAt(index) == ' ' || str.charAt(index) == '\t');
}