What is controlling how many times it prints? Look at the for loop statement. Change that so it loops the correct number of times.
Type: Posts; User: Norm
What is controlling how many times it prints? Look at the for loop statement. Change that so it loops the correct number of times.
Did you try it? What happened?
Why does the code change the value of i two times inside of the loop?
i = word.indexOf(word);
i = word.indexOf(firstLetter);
If your are not sure, then remove them.
Why does the code change the value of i two times inside of the loop?
It is dangerous to change the loop control variable inside the loop.
Please post the output from the program and add some comments describing what you want to change.
Please Edit your post and wrap your code with
<YOUR CODE HERE> to get highlighting. You did not...
Have you tried it yet to see what happens? See posts #6 & #8 where I gave the steps the code should do.
Use the + operator:
"sdd" + "e" -> "sdde"
It looks like you are getting the second part of the String OK. what is happening to the first letter that is supposed to be concatenated to the end of the String? It looks like you remove it and...
What prints out when you execute the program? Is the output what you want?
Solve the problem one small step at a time.
Take a String and move its first character to the end of the String. Can you do that?
When that is done, what next?
If you understand the methods and how to use them and what they do, what are you waiting for to use some of them to solve the problem?
A hint:
1)extract two Strings from the one String. One with a...
Start by removing one character from the start of the String.
Concatenate that character at the end of the String.
Print it.
Do it again until done.
If the project is only changing the position of characters in a String, look at the String class's methods.
And the StringBuilder and StringBuffer classes.
Can you define a "word rectangle" and show an example?