So I want to iterate for each character in a string.

So I thought:

for (char c : "xyz")

but I get a compiler error:

MyClass.java:20: foreach not applicable to expression type

How can I do this?

9 Answers
9

Leave a Reply

Your email address will not be published. Required fields are marked *