0
What is the error in this java code?
https://code.sololearn.com/c46vLYmKhy2U/?ref=app I tried this code. Sample input: Arkham Man Chaplin Sample Output: A. M. Chaplin The program is incomplete actually. But i can't understand the errors that are coming. Could you please help me?
2 Answers
+ 3
Gamer To The Core- Born Gamer
There should be i < fn.length() as index start from 0
so if the string length is 10 then charAt(10) will give exception because there is no 10th index even there is 9th index (10 - 1) since index start from 0
if you want to use <= then i should start from 1 and there should be charAt(i - 1)
+ 1
AÍąJ tysm!