Question: I'm really good with VB and I have a project where I need to check an array. If the same item in an array exists twice or more it needs to be changed to an item that doesn't exist. Now I'm in a class where they're making us use Java for this project. 

I was wondering what is the equivalent of a for each loop in Java? I checked the JavaDocs and it only had info for the regular for loop, I didn't notice any section that said anything about a for each loop.

Answer: 
It's more subtle in Java than VB. You can find the official docs in the Oracle documentation here (towards the bottom):

[Java For Loops](https://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html)

The provided example is:

```
// Returns the sum of the elements of a

int sum(int[] a) {
    int result = 0;
    for (int i : a)
        result += i;
    return result;
}

```

Hope that helps. Be careful not to remove or add elements inside the loop or you will get a Concurrent Modification Exception.
try

```
 String arr [] = // you decide how this gets initialized

 for (String obj: arr) {
 }

```