Question: In the Java code below what are the errors? Please indicate the line numbers and the correction. File fileDir = new File (C: test) File

In the Java code below what are the errors? Please indicate the line numbers and the correction. File fileDir = new File ("C: \test") File file = new File("C: /test/test.txt") if(fileDir.exists()) { fileDir.mkdir(): System. out. Println ("The directory does not exist.\ nCreating directory..."): } else { System.out.printf ("The directory does exist at this location: %s ", fileDir getAbsolutePath()): } if (file. exists()) { System.out.println("The file does not exist Creating file..."): file.createFile(): System.out.printf("The file now exists and is located here %s ", file.getAbsolutePath()): } else { System.out.printf("The file already exists and is located here % ", file.getAbsolutePath()): PrintWriter output = new PrintWriter(fileName) double amount = 456.73: for(int i = 1: i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
