Solved

What Does the Following Code Do

Question 11

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents