Struggling with the Java Prime Directive Project

Hey everyone, I know this might seem stupid but I am really struggling with this Java project. I’ve been trying to come up with solutions and checking out stuff online for hours now, only to get to this one error, saying that I’m missing a semi-colon on line 26. There are probably more things I did wrong, but my brain seems to have shut down and my only escape is reaching out for help. Here is the code:

// Import statement:
import java.util.ArrayList;
class PrimeDirective {
  
  // Add your methods here:
  public boolean isPrime(int number){

    if(number == 2){
      return true;
    }
    if(number < 2){
      return false;
    }

    for (int i = 2; i < number; i++){
      if(number % i == 0){
        return false;
      }
    }
    return true;
  }

  public ArrayList<Integer> onlyPrimes(int[] numbers){
    ArrayList<Integer> primes = new ArrayList<>();
 
  for(int i = numbers){
    if(isPrime(i) == true){
      primes.add(i);
    };
  };
    return primes;
    }
  
  
  public static void main(String[] args) {

    PrimeDirective pd = new PrimeDirective();
    int[] numbers = {6, 29, 28, 33, 11, 100, 101, 43, 89};

System.out.println(pd.onlyPrimes(numbers));
  }  

}

Wrong syntax for for-each loop.

// You wrote:
for (int i = numbers) {

// It should be:
for (int i : numbers) {

thank you so so much!!

1 Like