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, 22.06.2019 10:00
What is a society that has moved to the internet rather than relying on physical media called
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Which of the following includes the three primary network access technologies? dsl, cable modem, broadband lan, wan, man voip, uc, iptv tcp/ip, ftp, dhcp
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, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
English, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
English, 16.09.2020 01:01
question
Arts, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
question
Mathematics, 16.09.2020 01:01
Questions on the website: 13722361