import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class TreeDriver { public static void main(String [] args) { Scanner input = new Scanner(System.in); Tree test = new Tree(); String label ; String prompt; String message; String filename = "sample.txt"; Tree family = new Tree(); try { input= new Scanner(new File(filename)); while(input.hasNextLine()){ label = input.nextLine(); prompt = input.nextLine(); message = input.nextLine(); family.root = new TreeNode(label,prompt,message); family.addNode(label, prompt, message, label); } input.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
I made sure the file and the class are in the same project but no matter what I do, it keeps throwing that exception. Please help I as soon as you can b/c this is part of an hw assignment