In python, you can do this:
for item in [a, b, c, d]:
some-code
Is something similar possible in java, where you declare the array in the for loop condition area?
My gut reaction is to do this:
public static void main(String[] args) {
for (String string : String myArr[] = {a, b, c, d}) {
some-code
}
}
But that does not work
Note: I did a preliminary search before asking, the similar-seeming question I found (Initializing an array in Java using the 'advanced' for each loop [duplicate]) is different.