1Z0-811 Exception Handling and Development Tools Practice Question
A developer compiles a Java application using the command `javac -d bin src/com/example/App.java`. Which of the following is true?
⚠ Common exam trap
Oracle often tests the misconception that `-d` specifies the source directory or that `javac` can produce JAR files, leading candidates to confuse the roles of `javac` and `jar` tools.
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
✓
The compiled .class files are placed in the `bin` directory maintaining the package structure.
The `-d` option in the `javac` command specifies the destination directory for compiled `.class` files. When `-d bin` is used, the compiler places the `.class` files into the `bin` directory, preserving the package directory structure (e.g., `bin/com/example/App.class`). This is the standard behavior for organizing compiled output separately from source code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The compiler searches for source files in the `bin` directory.
Why it's wrong here
`-d` specifies output directory, not source directory.
- ✓
The compiled .class files are placed in the `bin` directory maintaining the package structure.
Why this is correct
`-d bin` sets the root for output; the class file will be at `bin/com/example/App.class`.
- ✗
The compiler creates a JAR file named `App.jar` in the `bin` directory.
Why it's wrong here
`javac` does not create JAR files; that is done by `jar` tool.
- ✗
The compiler compiles the code into a named module.
Why it's wrong here
Compiling into a module requires module-info.java and additional flags like `--module-source-path`.
Go deeper
Related to this question
About these practice questions
One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.