com.example.mistakes.expression._11_IgnoredReturnValue.Ex1

🚀 com.example.mistakes.expression._11_IgnoredReturnValue.Ex1

Question fetched from API endpoint api/expression/11/1

API Response

GET /api/expression/11/1
{
  "result": [
    {
      "message": "com.example.mistakes.expression._11_IgnoredReturnValue.Ex1",
      "before": "    String before() {\n      String s = \"Hello World!\";\n      s.substring(6);\n      return s;\n    }\n",
      "after": "    String after() {\n      String s = \"Hello World!\";\n      return s.substring(6);\n    }\n",
      "chapter": 2,
      "id": "2_11_1",
      "className": "Ex1",
      "path": "file:///home/runner/work/100_java_mistakes/100_java_mistakes/back/src/main/java/com/example/mistakes/expression/_11_IgnoredReturnValue.java"
    }
  ],
  "length": 1
}

before

before
String before() {
  String s = "Hello World!";
  s.substring(6);
  return s;
}

after

after
String after() {
  String s = "Hello World!";
  return s.substring(6);
}