ExamQuestions.com

Register
Login
Java SE 8 Programmer II Exam Questions

Oracle

Java SE 8 Programmer II

22 / 130

Question 22:

Given the code fragment: public static void main (String [ ] args) throws IOException{ BufferedReader br = new BufferedReader (new InputStremReader (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? 

Answer options:

A. int GDP = Integer.parseInt (br.readline());
B. int GDP = br.read();
C. int GDP = br.nextInt();
D. int GDP = Integer.parseInt (br.next());