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 something (I can't think of anything at the top of my head). The fragment code would be like this:
public void adjustScore(String[] str){
for(int j= 0; j < str.length; j++){
if(str[j] != //idk, something//
str[j]= "josh";
}
else{};
}
But, how would this look if it was a String instead of a String[]?
public void adjustScore(String str2){
for(int j=0; j < str2.length(); j++){
// How do I call an element from the String? Would I still use str2[j]?//