nerdexam
GIAC

GSSP-JAVA · Question #66

Which of the following code fragments will throw NumberFormatException?

The correct answer is C. Float flt = new Float("true"). See the full explanation below for the reasoning.

Question

Which of the following code fragments will throw NumberFormatException?

Options

  • ADouble dbl = new Double(true);
  • BCharacter ch = new Character('A');
  • CFloat flt = new Float("true");
  • DBoolean bool = new Boolean("123");

How the community answered

(51 responses)
  • A
    6% (3)
  • B
    10% (5)
  • C
    80% (41)
  • D
    4% (2)

Community Discussion

No community discussion yet for this question.

Full GSSP-JAVA Practice