I need help showing me where I went wrong.
Given problem is. Print to System.out a new string composed of every alternate character in sentence starting with the first. Use a loop to go through a string and retrieve characters from alternate index positions. Append these characters to another string and print. Output should equal "pes ep"
The code I have so far is... I am confident that the System.out parameters are wrong, but I might also have something else wrong. I could use help fixing.
String sentence = "please help"
int num1="0"
sentence.charAt(num1);
for (num1 = 0; num1 <= sentence.length(); num1 += 2) {
System.out.println(num1);
run:
0
2
4
6
8
10
12
14
16
18
Thank you,