How do I apply the for-each loop to every character in a String in Java?
- by oxinabox.ucc.asn.au
So I want to iterate for each character in a string.
So I thought:
for (char c : "xyz")
but I get a compiler error:
StackCharTester.java:20: foreach not applicable to expression type
How can I do this?