Courseiva
Question 235 of 513
Handling ExceptionsmediumDrag & DropObjective-mapped

1Z0-829 Handling Exceptions Practice Question

Order the steps to compile and run a simple Java program from the command line.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

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

Write the Java source code in a .java file, then compile with javac to produce a .class file, then run the class using java.

javac produces .class files; java runs the main method of the specified class. The classpath may need to be set if dependencies exist.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Write the Java source code in a .java file, then compile with javac to produce a .class file, then run the class using java.

    Why this is correct

    This order is correct because you must first create the source code, then compile it into bytecode, and finally execute the bytecode with the Java interpreter.

  • Write the Java source code in a .java file, then run with java, then compile with javac.

    Why it's wrong here

    This is incorrect because you cannot run a Java program without first compiling it. The java command expects a compiled .class file, not source code.

  • Compile with javac, then write the Java source code in a .java file, then run with java.

    Why it's wrong here

    This is incorrect because you need the source code before you can compile it. Compiling a non-existent file will fail.

  • Run with java, then compile with javac, then write the Java source code in a .java file.

    Why it's wrong here

    This is completely reversed. You cannot run or compile before writing the source code, and running before compiling is impossible.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-829 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-829 exam.