Oracle
1Z0-851 · Question #166
Given: String csv = "Sue,5,true,3"; Scanner scanner = new Scanner( csv ); scanner.useDelimiter(","); int age = scanner.nextInt(); What is the result?
The correct answer is D. An exception is thrown at runtime. See the full explanation below for the reasoning.
Question
Given: String csv = "Sue,5,true,3"; Scanner scanner = new Scanner( csv ); scanner.useDelimiter(","); int age = scanner.nextInt(); What is the result?
Options
- ACompilation fails.
- BAfter line 15, the value of age is 5.
- CAfter line 15, the value of age is 3.
- DAn exception is thrown at runtime.
How the community answered
(63 responses)- A5% (3)
- B14% (9)
- C8% (5)
- D73% (46)
Community Discussion
No community discussion yet for this question.