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)- A85% (33)
- B5% (2)
- C3% (1)
- D8% (3)
Explanation
You've hit your session limit · resets 5:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.