What is the difference between a String[] and String in a for loop (Java) : <p>Before you ask, yes I did Google this first. I haven't found a proper answer yet. I understand the syntax for a String array in a for loop, but not for a String. For example, let's say I have a fragment code which includes a for loop that's purpose is to adjust an element of the String to "josh" if that element isn't equal to <em>something</em> (I can't think of anything at the top of my head). The fragment code would be like this:</p>

<pre><code>public void adjustScore(String[] str){
    for(int j= 0; j &lt; str.length; j++){
        if(str[j] != //idk, something//
        str[j]= "josh";
        }
    else{};
}
</code></pre>

<p>But, how would this look if it was a String instead of a String[]? </p>

<pre><code>public void adjustScore(String str2){
    for(int j=0; j &lt; str2.length(); j++){
    // How do I call an element from the String? Would I still use str2[j]?//
</code></pre>
