I am trying to create a for-each loop in Java that iterates on every character in a string. When I try to do this I get an error in NetBeans:
for-each not applicable to expression type
required:array or java.lang.Iterable, found java.lang.String
This is the Java code on which I get an error:
for(char c : fen){
}
fen
is a String
I am trying to understand the source code of a game writen in C# and the foreach loop there worked:
foreach(char in fen){}