nerdexam
Oracle

1Z0-809 · Question #21

Given the code fragment: public static void main (String [ ] args) throws IOException { BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); System.out.print ("Enter GDP: ")…

The correct answer is A. int GDP = Integer.parseInt(br.readLine()). You've hit your session limit · resets 5:20pm (America/New_York)

Question

Given the code fragment: public static void main (String [ ] args) throws IOException { BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); System.out.print ("Enter GDP: "); //line 1 } Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?

Options

  • Aint GDP = Integer.parseInt(br.readLine());
  • Bint GDP = br.read();
  • Cint GDP = br.readLine();
  • Dint GDP = Integer.parseInt(br.next());

How the community answered

(39 responses)
  • A
    85% (33)
  • B
    5% (2)
  • C
    3% (1)
  • D
    8% (3)

Explanation

You've hit your session limit · resets 5:20pm (America/New_York)

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice