I plan to make a project that prints out every 3rd letter of a string value | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

I plan to make a project that prints out every 3rd letter of a string value

I get the StringIndexOutOfBoundsException when using while loops

10th Mar 2019, 10:34 AM
Mr.Gameplay Network
Mr.Gameplay Network - avatar
2 ответов
+ 16
using Jay Matthews sir comment : for(int i=2; i<s.length(); i+=3) System.out.print(s.charAt(i));
10th Mar 2019, 1:25 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
Jay Matthews I meant that the character will be printed for every 3 letters
10th Mar 2019, 11:23 AM
Mr.Gameplay Network
Mr.Gameplay Network - avatar