Question: IN JAVA The input file consists of a single column of int numbers. Write a program that 1. read this file and 2. compute the
IN JAVA


The input file consists of a single column of int numbers. Write a program that 1. read this file and 2. compute the sum of prime numbers only and 3. display the results In addition to this, add exception handling to your program. A prime number is a natural number greater than 1 that is only divisible by 1 and itself. The first 10 prime numbers are 2,3,5,7,11,13,17,19,23,29. In your program write and use the following method : returns true if n is prime, otherwise false input: file1-2.txt // delcare and initialize variables, if needed while(in.hasNextint())\{ int no = in.nextInt(); \}/ add your code here in.close(); \} // print the output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
