Ad
  • Custom User Avatar

    It rounds down, read this: https://beginnersbook.com/2013/12/java-string-substring-method-example/
    You also have to return 1 (if length is odd) or 2 (if it isn't) letters only.

    If you mean you're returning the whole testing string when the input is also testing being:

    expected:<t[]> but was:<t[esting]>
    

    That's how the testing framework works, it won't matter where the t came from, it's comparing 2 strings and the difference between one and the other is the expected only has a t and the returned (when returning testing) has esting after the t. Nohing to fix there.

  • Custom User Avatar

    It's a problem with your code, the expected value for testing is t (the middle one):