Quiz 11 Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

If "14t8" is entered in the following code, what does the program do? while(input!=null){ try{ totalincome+=Double.parsedouble(input); months++ } catch(NumberFormatException e) { System.out.println("Non-numeric data encountered in the file: " + e.getMessage()); } input=inputFile.readLine(); } A)input will be converted to a double and added to totalincome, months will be incremented by 1, and the while statement will be repeated until a null is entered B) input will cause a NumberFormatError, the catch clause will be executed, then the program will continue by asking for the next input value C) input will cause a NumberFormatError, the catch clause will execute, then terminate D) input will cause a NumberFormatError, the catch clause will be executed, then the while statement will be repeated until a value that can be parsed or a null is entered. If a null is entered, the program continues with the statement after the while statement; otherwise, this will be an endless loop.

(D)

The default error message can be retrieved using ___ method. (E) getMessage() (F) getErrorMessage() (G) getDefaultMessage() (H) getDefaultErrorMessage()

(H)

What will be the results of the following statements? FileInputStream fstream = new FileInputStream("Input.dat"); DataInputStream inFile = new DataInputStream(fstream); (A) The inFile variable will reference an object that is able to read text from the Input.dat file (B) The inFile variable will reference an object that is able to read binary data from the input.dat file (C)The inFile variable will reference an object that is able to read random acces data from the input.dat file (D) None is correct

(B)


Kaugnay na mga set ng pag-aaral

Econ 1051: Exam #3 - Practice Exam

View Set

FamCom Quiz 3 Practice Questions

View Set

national flood insurance program

View Set

Theology Church History Chapter 2

View Set