What does the following code do?
Scanner keyboard = new Scanner(System.in) ;
String filename;
System.out.print("Enter the filename: ") ;
Filename = keyboard.readString() ;
PrintWriter outFile = new PrintWriter(filename) ;
A) It writes to a file named filename.
B) It allows the user to enter the name of the file that data will to be written to.
C) It establishes a connection with a file named filename.
D) Nothing. The code contains a syntax error.
Correct Answer:
Verified
Q7: This type of loop will always be
Q9: What will be the values of x
Q10: Assume that inputFile references a Scanner object
Q10: A loop that repeats a specific number
Q12: How many times will the following do-while
Q13: A for loop normally performs which of
Q14: Before entering a loop to compute a
Q15: How many times will the following do-while
Q16: What will be the value of x
Q21: When working with the PrintWriter class, which
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents