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 be written to.
C) It establishes a connection with a file named filename.
D) Nothing; the code contains a syntax error.
Correct Answer:
Verified
Q21: When working with the PrintWriter class, which
Q22: How many times will the following do-while
Q25: Which of the following is the method
Q31: What will be the value of x
Q32: Given the following statement, which statement will
Q34: How many times will the following do-while
Q37: The _ loop is ideal in situations
Q38: How many times will the following for
Q40: Assuming that inputFile references a Scanner object
Q53: What will be the value of x
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