The Prime Directive Project error

I am stuck on one of the steps in the Prime Directive Project. I feel that I have followed the instructions exactly. Can someone please help me with the “missing return statement error” I am getting here?


import java.util.ArrayList;

class PrimeDirective {
  
  public boolean isPrime(int number) {

    if (number == 2){
    return true;

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

      if ((number % i) == 0){
      return false;

      }else{
      return true;
      }}
    }
  }
  
  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.isPrime(6));
  }  

}

1 Like

Hello @ohene-danquah, is there any error being thrown? Do you have a specific question?