I can not find this program to count on the empty space, I think there is a logic error in the loop, But I am naive in understanding myself, any suggestions?
System.out.print ("Enter a string:"); String migration = keyboard.next (); Int numberBank = 0; // string length int length = myString.length () - 1; System.out.println ("length" + length); (Int sequence = 0; sequence> gt; = length; ++ sequence); {If (myString.charAtAt (length) == '') {numBlanks + = 1; Length - = length; } And length - = length; Some bugs that I can see are:
Remove the strong> semicolon at the end of the loop .
Next
Sequence & gt; = Length should be
sequence & lt; = Length
and
if (myString.charAt (length) == '') should be
if (myString.charAtAt (sequence) == '')
and you need to change length
That you are already changing the sequence
.
So we meet:
for (int sequence = 0; sequence
Comments
Post a Comment