Question: This is my code for simply creating a file instance. But my output is File does not exist, which means that it's going through the

This is my code for simply creating a file instance. But my output is "File does not exist", which means that it's going through the catch block? I have PovertyData.txt in the sam folder as this program, so I am unsure why it does that

public static void main(String[] args){ File file = new File("PovertyData.txt"); //create file instance Scanner input = null; int lineNum = 0; ArrayList spopList = new ArrayList(); //initialize list of statepopulation PopProcess processor = new PopProcess(); try { input = new Scanner(file);//create instance of file scanner } catch (FileNotFoundException a){ System.out.println("File does not exist"); return; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!