Reverse and repeat String words in java -
So I have three times behind sentences, repeating my text, there is a problem in counting letters in the word Will the person help me out? I have tried googling and looking for a method and none of them can not get to work. It would be greatly appreciated
At the end of your IF-statement you have a semi-colon at the wrong place The subsequent statement will always be executed.
if (text.charAt (i) == 'e'); // Remove the last character here {System.out.println ("e:" + text.charAt (i) + i); Count ++; }
For your reverse layer function, I do not know whether the back text; can be reached outside of your loop, but you are overwriting the value of reverse on each walk, I think you would see the value of reverse instead Try to add the value of text.charAt (j) to: string reverse = ""; // should be initial for an empty string (int j = text.length () - 1; j & gt; = 0; j--) {reverse + = text.chart (j); / * The remaining contents of your loop * /
and what do you expect your repeatLetters function to do? You are designating the given string as a local variable name repeat and then you are refunding that value without doing anything. You can enter text in an empty string Adding a bar can use a return. Repeat the string = ""; (Repeat + = text + ""; for int i = 0; i
Comments
Post a Comment