Assume that inputFile is a Scanner object used to read data from a text file which contains a series of double values. Select an expression to complete the following code segment, which reads the values and prints them in standard output, one per line, in a field 15 characters wide, with two digits after the decimal point. while (inputFile.hasNextDouble() )
{
Double value = inputFile.nextDouble() ;
___________________________________ // statement do display double value
}
A) System.out.printf("%15f",value) ;
B) System.out.printf("%.2f",value) ;
C) System.out.printf("%15.2f",value) ;
D) System.out.printf("%15.2f\n",value) ;
Correct Answer:
Verified
Q49: Consider the following code snippet: Scanner in
Q51: Insert the missing code in the following
Q52: Assuming that inputFile is a Scanner object
Q52: The _ method of the Character class
Q53: When reading words using a Scanner object's
Q55: Consider the following code snippet: Scanner in
Q56: Assume that inputFile is a Scanner object
Q57: Insert the missing code in the following
Q58: When reading words with a Scanner object,
Q59: Consider the following code snippet. File inputFile
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