Here is my program:
public class Mycode{
    public static void main(String[] args) {
        System.out.println("Welcome to the innovation and tech data mining table");
        Scanner sc = new Scanner(System.in);
        Scanner input = new Scanner(new File("Data2.txt"));
        while (input.hasNext()){
            String data = input.nextLine();
        }
        System.out.println(data);
    }
}
Basically I'm taking a text file and storing it in my variable data. The problem I'm having is that it refuses to print out the data as it says it can't be resolved to a variable. Anyone have any way around this?
 
     
    