Question: The code provided below contains syntax and / or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors,
The code provided below contains syntax andor logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.
Code:
Program reads in a file of phone numbers without area codes
inserts in front of each phone number
and produces an output file with the new complete phone numbers
import java.nio.file.;
import java.io;
import java.nio.channels.FileChannel;
import static java.nio.file.StandardOpenOption.;
public class DebuggingExercise
public static void mainString args
Path fileIn
Paths.getrootsandboxDebugDatatxt;
Path fileOut
Paths.getrootsandboxDebugDataNew.txt;
String areaCode ;
String phone;
InputStream input nul;
OutputStream output nul;
try
input Files.newInputStreamfileIn;
BufferedReader reader BufferedReader
new InputStreamReaderinput;
output Files.newOutputStreamfileOut;
phone reader.readLine;
whilephone null
phone areaCode phone System.getPropertylineseparator";
byte phoneBytes phone.getBytes;
output.writephoneBytes;
phone reader.readline;
input.closes;
output.closes;
catch IOException e
System.out.printlne;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
