I am trying to find and compare the values of a String by calling the charAt(index) but I am getting an indexOutOfBoundsException when the String ends I want to catch the exception and let the method from which I am invoking the charAt(index) call from end, once it finds the end of the String ie when it says indexOutOfBoundsException. I could catch the exception or write a new charAt() method that overwrites the String method. Help me?
Our community of experts have been thoroughly vetted for their expertise and industry experience.