Computers and Technology

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

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, raiapowell
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
image
Computers and Technology, 23.06.2019 01:50, akornegay2
Write a program that uses a random number generator to generate a two digit positive integer and allows the user to perform one or more of the following operations: a. double the number. b. reverse the digits of the number. c. raise the number to the power of 2, 3, or 4. d. sum the digits of the number. e. if the number is a two-digit number, then raise the first digit to the power of the second digit. f. if the number is a three-digit number and the last digit is less than or equal to 4, then raise the first two digits to the power of the last digit. after performing an operation if the number is less than 10, add 10 to the number. also, after each operation determine if the number is prime. each successive operation should be performed on the number generated by the last operation. your program should not contain any global variables and each of these operations must be implemented by a separate function. also, your program should be menu driven. 7. (fraction calculator) write a program that
Answers: 1
image
Computers and Technology, 24.06.2019 23:00, person76
Systolic pressure is a measure of blood pressure when the ventricles relax and fil with blood ture or false
Answers: 1
image
Computers and Technology, 25.06.2019 08:30, avastanleyy
In the context of intentional computer and network threats a is a programming routine built into a system by its designer
Answers: 2
Do you know the correct answer?
In the Java code below what are the errors? File fileDir = new File("C:\test");
File file =...

Questions in other subjects:

Konu
English, 21.04.2021 16:30