Question: So I'm trying to pass the variable numbers into the printArray method but I'm not completely sure how to do it. Obviously I'm not doing it right but could someone please point me in the correct direction? Thanks in advance.

```
import java.io.*;
import java.util.Scanner;
public class Paniagua_ArrayProcessing{
    public static void main(String[] args) throws IOException{
            int[] numbers = new int[4];
            inputData();
            printArray(numbers);
    }
    public static int[] inputData() throws IOException{
            Scanner keyboard = new Scanner(System.in);
            String input;
            int lines;
            System.out.println("Please enter a file name: ");
            input = keyboard.nextLine();
            File myfile = new File(input);
            if (!myfile.exists()){
                    System.out.println("File not found.");
                    System.exit(0);
            }
            Scanner inputFile = new Scanner(myfile);
            lines = inputFile.nextInt();
            int[] numbers = new int[lines];
            for (int i=0; i<lines; i++){
                    if (inputFile.hasNextInt()){
                            int moreLines = inputFile.nextInt();
                            numbers[i] = moreLines;
                    }
            }
            inputFile.close();
            return numbers;
    }
        public static void printArray(int[] array){
                System.out.println(array[3]);
    }

}

```

Answer: 
instead of

```
 int[] numbers = new int[4];
 inputData();

```

just

```
int[] numbers =  inputData();

```

you are creating an array then you are creating again in `inputData()` and filling data in it and returning reference value so first initialization is useless here
I am not clear, on what you want you are doing here. I assume that you want to read all the numbers from the file and print the "Whole" Array.

Your Integer Array Variable "numbers" has not been initialized with the values read from the file and hence, you will not see any output If you run this code. To Fix, this, you need to assign the int[] variable returned from the method call inputData() to "numbers" Variable. I have updated these changes and tested the code on a sample file containing data 
1
2
3
4
5
This worked fine for me. Hope this helps you.

Note - Numbers in the Main method and inputData() Methods are different.

```
package test;

import java.io.*;
import java.util.Scanner;
public class test{
    public static void main(String[] args) throws IOException{
        int[] numbers = inputData();
        printArray(numbers);
    }
    public static int[] inputData() throws IOException{
        Scanner keyboard = new Scanner(System.in);
        String input;
        int lines;
        System.out.println("Please enter a file name: ");
        input = keyboard.nextLine();
        File myfile = new File(input);
        if (!myfile.exists()){
            System.out.println("File not found.");
            System.exit(0);
        }
        Scanner inputFile = new Scanner(myfile);
        lines = inputFile.nextInt();

        //Find the Number of Lines
        int count = 0;
        while (inputFile.hasNextLine()){
                    count++;
                    inputFile.nextLine();
                }
        int[] numbers = new int[count];
        inputFile.close();
        inputFile = new Scanner(myfile);
        for (int i=0; i<count; i++){
            if (inputFile.hasNextInt()){
                numbers[i] =  inputFile.nextInt();
            }
        }
        inputFile.close();
        keyboard.close();
        return numbers;      
    }
    public static void printArray(int[] array){
        for(int i=0;i<array.length;i++) {
        System.out.println(array[i]);
        }
    }

}

```