subject

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();

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:50
Write a method in the heapintpriorityqueue class called merge that accepts another heapintpriorityqueue as a parameter and adds all elements from the other queue into the current queue, maintaining proper heap order such that the elements will still come out in ascending order when they are removed. your code should not modify the queue passed in as a parameter. (recall that objects of the same class can access each other's private fields.)
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
To become an audio technician, the most successful tactics might include the following. (select all that apply). learning how to persuade other people gaining different types of experience in audio technology learning as much as possible about art history establishing a reputation as a reliable professional
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Font size, font style, and are all aspects of character formatting.
Answers: 2
You know the right answer?
In the Java code below what are the errors? File fileDir = new File("C:\test");
File file =...
Questions
question
Mathematics, 01.06.2020 10:57
question
Mathematics, 01.06.2020 10:57
question
Spanish, 01.06.2020 10:57
question
Mathematics, 01.06.2020 10:57
Questions on the website: 13722361