1Z0-811 · Question #70
Which two components can class declarations include?
The correct answer is C. Interfaces implemented by the class. Class declarations (the header line, e.g., public class Animal implements Runnable) can include both C (interfaces implemented) and D (the public modifier) - making this a two-answer question where both C and D are correct. Why C is correct: The implements clause is a direct…
Question
Options
- AA list of instance methods
- BThe main method
- CInterfaces implemented by the class
- DThe public modifier
How the community answered
(56 responses)- A4% (2)
- B2% (1)
- C95% (53)
Explanation
Class declarations (the header line, e.g., public class Animal implements Runnable) can include both C (interfaces implemented) and D (the public modifier) - making this a two-answer question where both C and D are correct.
Why C is correct: The implements clause is a direct part of the class declaration syntax, listing which interfaces the class fulfills (e.g., class Dog implements Animal, Serializable).
Why D is correct: Access modifiers like public appear in the declaration header itself - public class Foo - not inside the class body.
Why A and B are wrong: Instance methods and the main method live inside the class body (the { } block), not in the declaration. The declaration is just the signature line before the opening brace.
Memory tip: Think of a class declaration as a "job posting header" - it announces the class name, its access level (public), and what contracts it fulfills (implements). The actual work (methods, logic) goes inside the body. If you can write it before the {, it belongs to the declaration.
Topics
Community Discussion
No community discussion yet for this question.