- 2

Hiw do i print the even chars in java

I want print the even chars from the given string

24th Apr 2017, 5:36 AM
Mohan
Mohan - avatar
6 odpowiedzi
+ 10
for (int i = 0; i < STRING_SIZE; i+=2) { // print some_str[i]; } // where STRING_SIZE is your string length / number of characters in the string.
24th Apr 2017, 5:55 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
@Mohan Oh...I understand now srry for don't understand you xD @Abdul Moqueet I'm gonna type the code like that!
24th Apr 2017, 7:25 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 4
@Mohan ._. Alternative chars..... You mean 'A','B' like this?
24th Apr 2017, 6:43 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
0
guys use print alternative chars method u will easily print the even chars
24th Apr 2017, 6:34 AM
Mohan
Mohan - avatar
0
@veryhard main() string a="veryhard"; char[] c=a.toCharArray(); for(int I=0;I<c.length;I++) { sop(c[I])); } } this is for print alternative chars if u give I=1 then it will print even chars
24th Apr 2017, 6:50 AM
Mohan
Mohan - avatar
- 1
full code please hatsey rei
24th Apr 2017, 5:59 AM
Mohan
Mohan - avatar