Читать книгу OCP Oracle Certified Professional Java SE 17 Developer Study Guide - Jeanne Boyarsky - Страница 20
Reading the Exam Code
ОглавлениеMany of the questions on each exam are code snippets rather than full classes. Saving space by not including imports and/or class definitions leaves room for lots of other code. You should only focus on import
statements when the question specifically asks about them.
For example, it is common to come across classes on the exam with import
statements and portions omitted, like so:
public class Zoo implements Serializable { String name; // Getters/Setters/Constructors omitted }
In this case, you can assume that java.io.Serializable
is imported and that methods like getName()
and setName()
, as well as related constructors, exist. For instance, we would expect this code to compile:
var name = new Zoo("Java Zoo").getName();