Solved

What Does the Following Code Do

Question 23

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