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.
at java.util.Scanner.
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
Get step-by-step solutions from verified subject matter experts
