Limited-Time Offer: Enjoy 50% Savings! - Ends In 0d 00h 00m 00s Coupon code: 50OFF
Welcome to QA4Exam

Free practice questions with explanations

Oracle 1Z0-808 Dumps 2026 with Free Practice Questions and Answers

Practise for the Java SE 8 Programmer I exam with 10 original questions, each with an answer and explanation.

Topics: Working With Methods And Encapsulation, Creating And Using Arrays, Handling Exceptions, Java Basics and 5 more.

Includes single answer, dropdown, drag and drop, multiple answers and order list. A new question is added every 15 days.

1Z0-808 Practice Set Details

Vendor
Oracle
Exam Code
1Z0-808
Questions On This Page
10
Exam Topics Covered
9 of 9
Question Types
5
Newest Question
New Question
Every 15 days
Full Question Set
225
Certifications
Oracle DatabaseOracle Java
10 questions

Oracle 1Z0-808 Exam Questions and Answers by Topic

Java Basics

1 practice question on this topicWhat this topic covers

Question 1

Added

Single Answer

A small utility is distributed as Java source files. Its main class uses a public type from the java.time package, and the team wants a command-line build using the JDK without an IDE. The source file is named Report.java and the public class is named Report. Which command compiles the source file so it can subsequently be launched with the java command?

Correct answer: D

The JDK compiler is invoked with javac and the source filename, producing Report.class for launching with java Report. The java command runs a class rather than compiling this Java 8 source file. A package-qualified class name is not a source filename and does not invoke the compiler. The final command incorrectly treats javac as an argument to the runtime launcher.

Working with Java Data Types

1 practice question on this topicWhat this topic covers

Question 2

Added

Dropdown

A financial tool stores a whole-number count in an int and derives a wider numeric result for a calculation. Complete the assignment so the conversion occurs before multiplication and does not overflow as an int.

Choose the correct value for each blank.

int count = 1_500_000; long total = count * ;
Correct answer:

int count = 1_500_000; long total = (long) count * 2L;

Casting count to long before multiplication promotes the operation to long, preventing int overflow for the stated calculation. The long literal 2L also ensures the other operand is long. Casting to int or short does not widen the computation, and converting to double changes the required integral type. Without the cast on count, multiplying two int operands overflows before assignment to total; casting only the second operand would also promote the multiplication, but the blank options specify the cast position as written.

Using Operators and Decision Constructs

1 practice question on this topicWhat this topic covers

Question 3

Added

Multiple Answers

A menu handler receives an int command and must execute one of three actions: command 1 invokes start, command 2 invokes stop, and every other value invokes report. The implementation must compile under Java SE 8 and must not accidentally let one case execute the next action. Which two implementations satisfy the requirements? (Choose two.)

Correct answer: A, D

A uses valid switch labels and break statements to prevent fall-through, while the default handles all unmatched values. D uses equality comparisons and an else branch for every other integer. B falls through from a matching case and can invoke additional actions. C uses assignment, which is not a valid boolean condition in Java. E is invalid because a conditional expression requires value-producing operands, whereas these actions return void.

Creating and Using Arrays

1 practice question on this topicWhat this topic covers

Question 4

Added

Single Answer

A reporting service receives a rectangular table of daily measurements and must preserve every supplied row without copying it. The caller can provide rows of different lengths, and some rows may be empty. The service should print each available measurement in row order without assuming that all rows have equal length. Which implementation meets the requirement?

Correct answer: C

Nested enhanced for loops traverse each row independently, so rows of unequal lengths and empty rows require no special width assumption. Indexing every row to data[0].length fails when rows differ in length and also fails if the outer array has no first row. Allocating uniform rows copies or changes the supplied structure. A one-dimensional array cannot directly represent the provided row structure without flattening it.

Using Loop Constructs

1 practice question on this topicWhat this topic covers

Question 5

Added

Order List

A program must inspect an array from left to right, skip negative entries, stop as soon as it encounters the sentinel value 0, and print every other value. Arrange the loop-control steps in the order they must be performed for each current element.

Drag the steps into the correct order, or use the arrows.

  1. Print the current value.
  2. Advance to the next array element.
  3. Check whether the current value is zero and break if it is.
  4. Check whether the current value is negative and continue if it is.
Correct answer:
  1. Check whether the current value is zero and break if it is.
  2. Check whether the current value is negative and continue if it is.
  3. Print the current value.
  4. Advance to the next array element.

The sentinel check must happen first so zero terminates processing rather than being printed. A negative value is skipped only after it is known not to be the sentinel. Remaining values are printed, and then iteration advances. Printing before the checks would include skipped values or the sentinel; advancing before printing would omit the current value.

Working with Methods and Encapsulation

2 practice questions on this topicWhat this topic covers

Question 6

Added

Single Answer

A class holds a private int balance. Its public method deposit accepts an int amount, rejects negative amounts, and increases balance for nonnegative amounts. A caller passes a local int variable and later observes that the local variable itself remains unchanged. Which implementation correctly preserves encapsulation and explains the observed behavior?

Correct answer: C

The method can validate the parameter and update the private field directly, maintaining the class invariant. Java passes primitive arguments by value, so changing the method's parameter cannot change the caller's local int. Making the field public weakens encapsulation and still does not make a primitive argument an alias. Assigning rather than accumulating would also fail the stated deposit behavior. Declaring the method static does not alter argument-passing semantics.

Question 7

Added

Single Answer

A library class has a private field and two constructors: a no-argument constructor that establishes a valid default state, and a constructor that accepts a value and should reuse the same initialization logic. The value-taking constructor must perform no duplicated initialization code, and the class must compile in Java SE 8. Which constructor declaration is valid?

Correct answer: B

A constructor may delegate to another constructor in the same class with this(...), and that invocation must be its first statement. The value-taking constructor can therefore invoke the no-argument constructor's initialization before assigning its supplied value. A constructor cannot invoke both super(...) and this(...) as constructor delegation statements, and this(...) cannot appear after an assignment. The reciprocal delegation shown in C would also create a constructor cycle rather than a valid initialization path.

Working with Inheritance

1 practice question on this topicWhat this topic covers

Question 8

Added

Drag And Drop

A Java SE 8 application has a base class Shape and subclasses Circle and Rectangle. A method receives a Shape reference, and the code must use runtime polymorphism for drawing while safely performing a Circle-specific operation only when the object is actually a Circle. Match each code requirement to the Java mechanism that meets it.

Drag each item onto its matching target. On a phone: tap an item, then tap a target.

Call the subclass implementation through a Shape reference
Run a Circle-only operation after verifying the actual object type
Invoke the superclass constructor from a subclass constructor
super(...) constructor invocation
Overridden instance method dispatch
instanceof followed by a cast
Correct answer:
  • Call the subclass implementation through a Shape reference → Overridden instance method dispatch
  • Run a Circle-only operation after verifying the actual object type → instanceof followed by a cast
  • Invoke the superclass constructor from a subclass constructor → super(...) constructor invocation

Overridden instance methods dispatch according to the runtime object, even when the reference type is Shape. The instanceof check can establish that the referenced object is a Circle before a narrowing cast and Circle-specific call. A subclass constructor uses super(...) to invoke a superclass constructor, and that invocation must be the first constructor statement. A cast alone does not verify runtime type, and super is not the mechanism for polymorphic method selection.

Handling Exceptions

1 practice question on this topicWhat this topic covers

Question 9

Added

Single Answer

A batch importer reads records and calls a method that parses each record. The parser is specified to report malformed input with a checked exception, and the importer must continue processing later records while recording the failure. The importer may not change the parser's signature or silently discard the error. Which approach best meets these requirements?

Correct answer: C

Catching the specific checked exception around each parse operation allows the loop to record one malformed record and proceed to later records. Catching Exception around the whole batch does not provide the required per-record recovery and returning stops processing. Declaring throws delegates handling rather than meeting the importer's responsibility. Error represents serious JVM or system-level conditions and should not be treated as an ordinary malformed-record result.

Working with Selected Classes from the Java API

1 practice question on this topicWhat this topic covers

Question 10

Added

Dropdown

A Java SE 8 application keeps a mutable text report and needs to append a label, insert a separator at index 0, then produce an immutable String for storage. Complete the expressions using StringBuilder methods with the required behavior.

Choose the correct value for each blank.

StringBuilder report = new StringBuilder(); report.("summary"); report.(0, "-"); String saved = report.();
Correct answer:

StringBuilder report = new StringBuilder(); report.append("summary"); report.insert(0, "-"); String saved = report.toString();

append adds the label to the end of the mutable builder, insert(0, ...) places the separator at the beginning, and toString creates the String value needed for storage. substring returns a String but does not perform the required conversion of the complete builder through the intended API call. append cannot insert at a specified index, and replace or setCharAt does not append the label. toCharArray returns a character array, while length and capacity return integers.

More Oracle Practice Questions

Get the Full Oracle 1Z0-808 Dumps as PDF and Practice Test

10 questions are free on this page and the full set has 225. It comes as a PDF and an online practice test, with 90 days of free updates.