Do you remember the substitution principle from math? if a = b, you can replace every 'a' with 'b', and things are still ok. it's the same in
java. When the API says 'this method returns a String', you can effectively treat the method as a String. In fact, you almost HAVE to.
In your code, you wrote this:
and we know that 'substring' returns a string. so effectively, we have
and localNumber is defined as an 'int', effectively giving this:
You can't assign a String to an int. That is what the compiler is telling you.