How to get the program to read a set of integers from an input file. The goal is to store them in an array and then display greater values than input. Also, Also, create a method called greater_than_n() that accepts an integer array and an integer n. The purpose of this method is to display numbers greater than n
import java.util.Scanner;
import java.io.*;
public class Lab5 // File Name{
public static void main(String[] args) throws IOException
{
Scanner userInput = new Scanner(System.in);
File Integers = new File("Integers.txt");
Scanner inputReader = new Scanner(Integers);
String line = inputReader.nextLine();
System.out.print(line);
inputReader.close();
System.out.print("Enter an Integer: ");
int userAction = userInput.nextInt();
System.out.println("The numbers in the input file that are greater than " + userAction + " are: ");
for (int index = 0; index < Integers.length; index++)
{
if(Integers[index] > userAction)
{
System.out.print(Integers + " ");
}
}
}
}