Question: I downloaded the file, but java still says the file is found, why?? Exception in thread main java.io.FileNotFoundException: numbers.txt (???????????) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195)

I downloaded the file, but java still says the file is found, why?? Exception in thread "main" java.io.FileNotFoundException: numbers.txt (???????????)

at java.io.FileInputStream.open0(Native Method)

at java.io.FileInputStream.open(FileInputStream.java:195)

at java.io.FileInputStream.(FileInputStream.java:138)

at java.util.Scanner.(Scanner.java:611)

at Practice.main(Practice.java:6) Below is my code: import java.util.*; public class Practice{ public static void main(String[] args) throws FileNotFoundException{ File numbers=new File("numbers.txt"); Scanner input=new Scanner(numbers); double sum=0; for(int i=1;i<6;i++){ double a=input.nextDouble(); sum=sum+a; System.out.print("Number="+sum); } System.out.printf("sum=%-0.1f",sum); } }

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!