IT Fundamentals1Z0-8111Z0-829

Oracle Java: Foundations, OOP Principles, and Java SE Programming

Java has been one of the most widely deployed programming languages in the world for over 25 years. It powers enterprise backends, Android apps, big data platforms, and countless financial systems. Oracle offers two Java certification levels: Java Foundations (1Z0-811, entry-level conceptual) and Java SE 17 OCP (1Z0-829, the professional certification for experienced Java developers). This guide covers the core concepts tested across both — from Java's fundamental syntax and object-oriented principles to the advanced features introduced in Java 11-17.

13 min
4 sections · 10 exam key points

Java Fundamentals: Types, Variables, and Control Flow

Java is a statically typed, compiled language that runs on the JVM (Java Virtual Machine) — 'write once, run anywhere'. Primitive types: byte (8-bit, -128 to 127), short (16-bit), int (32-bit, default for integers), long (64-bit, suffix L — 100L), float (32-bit decimal, suffix f — 3.14f), double (64-bit decimal, default for decimals), char (16-bit Unicode character, single quotes — 'A'), boolean (true or false). Wrapper classes: Integer, Double, Character — autoboxing converts primitives to wrappers automatically (Integer x = 5), unboxing converts back. String is not a primitive — it is an immutable Object (String pool — string literals are cached). Control flow: if/else if/else, switch (traditional with break, switch expression in Java 14+ — returns a value directly), for (traditional, enhanced for-each for iterables), while, do-while, break (exit loop), continue (skip iteration), labeled break/continue (for nested loops). Java operators: arithmetic (+, -, *, /, % — integer division truncates: 7/2 = 3), compound assignment (+=, -=), increment/decrement (++i pre-increment, i++ post-increment — different return values when used in expressions), ternary (condition ? valueIfTrue : valueIfFalse).

Object-Oriented Programming in Java

Java is an object-oriented language — everything is a class or interface (except primitives). Class anatomy: fields (instance variables), constructors (same name as class, no return type — called with new keyword), methods (return type + name + parameters). Access modifiers: public (visible everywhere), protected (visible within package and subclasses), package-private/default (no modifier — visible within same package only), private (visible only within the class — encapsulation). Inheritance: extends keyword — subclass inherits all non-private fields and methods of superclass. Method overriding: same signature, different implementation in subclass — @Override annotation verifies the override is correct. super() calls superclass constructor (must be first line). Polymorphism: a superclass reference can hold a subclass object — method calls resolve to the actual object's type at runtime (dynamic dispatch). instanceof operator checks type at runtime. Abstract classes: cannot be instantiated, may have abstract methods (no body) that subclasses must implement. Interfaces: define a contract — all methods are implicitly public abstract (unless default or static methods in Java 8+). A class can implement multiple interfaces (multiple inheritance of type) but can only extend one class.

Collections, Generics, and Functional Programming

Java Collections Framework provides standard data structure implementations. List (ordered, allows duplicates): ArrayList (backed by array, fast random access, slow insertion in middle), LinkedList (doubly linked list, fast insertion/deletion, slow random access). Set (unordered, unique elements): HashSet (hash table, O(1) add/contains, no order), LinkedHashSet (insertion order maintained), TreeSet (sorted order, O(log n) operations). Map (key-value, unique keys): HashMap (O(1) average), LinkedHashMap (insertion order), TreeMap (sorted by key). Generics: type parameters prevent ClassCastException at compile time — List<String> guarantees only Strings, no casting needed. Wildcards: List<?> (unknown type), List<? extends Number> (Number or subtype), List<? super Integer> (Integer or supertype). Functional programming in Java (Java 8+): Lambda expressions (anonymous function — (x) -> x * 2), method references (Math::abs, String::new), functional interfaces (one abstract method — Predicate<T>, Function<T,R>, Consumer<T>, Supplier<T>), Stream API (fluent pipeline over collections — filter, map, sorted, collect, reduce, forEach), Optional<T> (container for potentially null values — avoids NullPointerException).

Exception Handling, I/O, and Java 17 Features

Exception handling in Java: checked exceptions (must be caught or declared — IOException, SQLException), unchecked exceptions (RuntimeException subclasses — NullPointerException, ArrayIndexOutOfBoundsException, ClassCastException — do not need to be declared). try-with-resources: automatically closes AutoCloseable resources (InputStream, Connection) when the try block exits — eliminates finally blocks for resource cleanup. Multi-catch: catch (IOException | SQLException e) — handle multiple exception types in one block. Java I/O: InputStream/OutputStream (bytes), Reader/Writer (characters), BufferedReader/BufferedWriter (buffered for performance), Files utility class (Java 7+ NIO.2 — Files.readAllLines, Files.write, Files.copy, Files.delete). Java 17 features relevant to OCP: Records (immutable data classes — record Point(int x, int y) {} automatically generates constructor, getters, equals, hashCode, toString), Sealed Classes (restrict which classes can extend a class — sealed class Shape permits Circle, Rectangle), Pattern Matching for instanceof (if (obj instanceof String s) { s.length(); } — no cast needed), Switch Expressions (switch expression with arrow syntax — no fall-through, returns value), Text Blocks (multiline strings delimited by triple quotes).

Key exam facts — 1Z0-811 / 1Z0-829

  • Java integer division truncates: 7/2 = 3 (not 3.5) — use 7.0/2 or cast for double result
  • String is immutable in Java — string literals are pooled; use StringBuilder for concatenation in loops
  • Method overriding requires same signature; overloading requires different parameters
  • checked exceptions must be caught or declared; unchecked (RuntimeException) need not be declared
  • try-with-resources auto-closes AutoCloseable resources — replaces finally { close() }
  • ArrayList: fast random access O(1); LinkedList: fast insertion/deletion at known position
  • HashMap: O(1) average for get/put; TreeMap: O(log n), sorted by natural order or comparator
  • Lambda: (x) -> x * 2; Stream API: list.stream().filter().map().collect(Collectors.toList())
  • Java 17 records: immutable, auto-generates constructor, getters, equals, hashCode, toString
  • Sealed classes restrict which classes can extend — permits keyword lists allowed subtypes

Common exam traps

== compares object content in Java

== compares object references (memory addresses) for Objects — two different String objects with the same content are == false unless they are the same instance from the String pool. Use .equals() to compare object content. For primitives, == compares values correctly.

abstract classes and interfaces serve the same purpose

Abstract classes can have state (fields), constructors, and concrete methods — use when classes share implementation. Interfaces define contracts with no state (before Java 8) — use for multiple type inheritance. A class can implement multiple interfaces but extend only one class.

Catching Exception at the top level is good defensive coding

Catching Exception (or worse, Throwable) hides bugs by swallowing unexpected exceptions. Catch the most specific exception type you can handle. Let unexpected exceptions propagate to a top-level error handler that logs and alerts — silent swallowing of exceptions is a major source of production bugs.

Practice this topic

Test yourself on Oracle Java Programming

JT Exams routes you to questions in your exact weak areas — automatically, after every session.

No credit card · Cancel anytime

Related certification topics