How To Loop Through a String

Loop Through a String


String myString = "abcd";
myString.length(); // holds a value of 4
What will the code below output?

    String myString = "abcd";
        for(int i = 0; i< myString.length(); i++)
            {
               String myLetter = myString.substring(i,i+1);
               System.out.print(myLetter + "\n");
             }
        

Projects for my Computer Science Students

String Loop Assignments

?php include $incl. "body_footer.php"; ?>