O'Reilly logo

A Programmer’s Guide to Java® SE 8 Oracle Certified Associate (OCA) by Rolf W Rasmussen, Khalid A Mughal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix F. Annotated Answers to Mock Exam I

This appendix provides annotated answers to the questions in the mock exam for the Java SE 8 Programmer I certification found in Appendix E.

Annotated Answers

Q1 (a), (b), (c), and (e)

Only local variables need to be explicitly initialized before use. Fields are assigned a default value if not explicitly initialized.

Q2 (e)

Giving parameters (2, 3) to the method substring() constructs a string consisting of the characters from index 2 (inclusive) to index 3 (exclusive) of the original string; that is, the string returned contains the character at index 2. The first character is at index 0 and the last character is at index 1 less than the number of characters in the string.

Q3 (c)

The loop prints ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required