I cannot understand which this code doesn't compile because of return statement
<pre><code>import java.util.Scanner;
public class Test{
   public static int[] calculateFactors(int n){
      int[] array = new int[n];
      for(int i = 0; i&lt;=n;i++){
         if(n%i==0){
            return array[i];
         }
      }
   }

   public static void main(String[] args){
      System.out.println("Please enter the number you want to find the factors for:");
      Scanner input = new Scanner(System.in);
      int n = input.nextInt();
      System.out.println(calculateFactors(n));
   }
}
</code></pre>

<p>I don't understand why I get an error. I am trying to write  a code where a user inputs a number and the program returns all the factors of this number.
Could anyone please tell me why when I am not being able to return the array with corresponding i factors.</p>

<p>Thank you</p>
