In the Java code below what are the errors?
File fileDir = new File("C:\test");
File file =...
Computers and Technology, 13.04.2021 03:50 makalanharrison
In the Java code below what are the errors?
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: \n%s\n", fileDir. getAbsolutePath());
}
if (file. exists()) { System. out. println("The file does not exist.\nCreating file...");
file. createFile(); System. out. printf("The file now exists and is located here:\n%s\n", file. getAbsolutePath());
}
else { System. out. printf("The file already exists and is located here:\n%s\n", file. getAbsolutePath());
}
PrintWriter output = new PrintWriter(fileName); double amount = 456.73;
for (int i = 1; i <= 10; i++) { output. printf("Account %d:\t $%.2f" + System. getProperty("line. separator"), i, amount += 23.45);
}
output. close(); try (Scanner input = new Scanner(file)) { System. out. println("The contents of the file are listed below:");
while (input. hasNext()) { String line = input. nextLine(); System. out. println(line); }
} input. close();
Answers: 2
Computers and Technology, 22.06.2019 19:00, detrickboucicaut
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
Computers and Technology, 24.06.2019 10:30, brandon1748
You're programming an infinite loop. what must you include in your code to prevent crashes? in roblox
Answers: 2
Computers and Technology, 25.06.2019 01:30, jamesvazquez3135
The physical parts or components of a computer system is called .
Answers: 1
Computers and Technology, 25.06.2019 05:00, adajadavis2843
Which of the following statements best deceive the relationship between carrying capacity and population size
Answers: 1
Business, 13.01.2021 18:40
Mathematics, 13.01.2021 18:40
Business, 13.01.2021 18:40
Mathematics, 13.01.2021 18:40
Computers and Technology, 13.01.2021 18:40