|
michcio,
Mistake is on int c = a.length();
change it to int c = a.length()-1;
Please refer to javadoc of substring method of String for greater details, In summary it says "@param endIndex the ending index, exclusive."
Just a tip, When you need only one character from string you can use charAt() method of String as well ..
Hope it helps,and dont forget to lookup the String's javadoc.
__________________
dont worry newbie, we got you covered.
|