1Z0-811 Exception Handling and Development Tools Practice Question
You are a junior developer tasked with generating API documentation for a large Java project. The project uses Javadoc comments extensively, and you need to generate HTML documentation that includes all public and protected classes and methods. You have access to the source files in the `src` directory, and you want the output to be placed in a `docs` folder. Additionally, you want to include a custom header and footer in each generated page. The project uses multiple packages like `com.example.app`, `com.example.util`, and `com.example.data`. You plan to run the javadoc command from the project root. Which command should you use?
⚠ Common exam trap
Oracle often tests the distinction between `-subpackages` and explicitly listing packages, where candidates mistakenly choose `-subpackages` thinking it is more efficient, but it may include unwanted packages and does not match the requirement to document only the three specified packages.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
javadoc -d docs -header 'My App API' -footer 'Copyright 2024' -sourcepath src com.example.app com.example.util com.example.data
It specifies the exact package names (`com.example.app`, `com.example.util`, `com.example.data`) that contain the public and protected classes and methods required for the documentation, uses `-d docs` to set the output directory, and includes `-header` and `-footer` to add custom header and footer text. This command generates HTML documentation for only the specified packages, meeting all requirements.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
javadoc -d docs -header 'My App API' -footer 'Copyright 2024' -sourcepath src com.example.*
Why it's wrong here
Wildcards in package names are not supported; you must specify individual package names.
- ✗
javadoc -d docs -private -sourcepath src com.example.app com.example.util com.example.data
Why it's wrong here
The `-private` flag includes private members, which is not required; also no header/footer.
- ✓
javadoc -d docs -header 'My App API' -footer 'Copyright 2024' -sourcepath src com.example.app com.example.util com.example.data
Why this is correct
Correctly sets output, header, footer, sourcepath, and lists specific packages to document.
- ✗
javadoc -d docs -header 'My App API' -footer 'Copyright 2024' -sourcepath src -subpackages com.example
Why it's wrong here
The flag is `-subpackages`, not `-subpackages` (typo). Also, this would document all subpackages recursively, but the command is still incorrect due to the typo.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-811 question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.