A comprehensive study repository for the Oracle Certified Professional: Java SE 17 Developer (1Z0-829) exam. This repository contains well-documented code examples, exam tips, common traps, and practical demonstrations for every topic covered in the OCP Java 17 certification.
- Exam-Focused: Every example is designed with the exam in mind, highlighting common traps and edge cases
- Comprehensive Coverage: All exam topics from the official Oracle study guide
- Working Examples: All code compiles and runs, with output demonstrations
- Clear Documentation: Extensive inline comments explaining concepts and exam tips
- Quick Reference: Tables, comparisons, and checklists for rapid review
- Best Practices: Follows Java 17 features and modern coding standards
Topics: Java basics, primitive types, text blocks, operators, and fundamental concepts
- Text blocks (Java 13+)
- Variable declarations and initialization
- Primitive types and wrapper classes
- Identifier naming rules
Topics: All Java operators and operator precedence
- Arithmetic, relational, and logical operators
- Operator precedence and associativity
- Short-circuit evaluation
- Ternary operator
Topics: Decision structures and loops
- if/else statements
- switch statements (traditional and enhanced)
- for, while, and do-while loops
- break, continue, and return
Topics: String, StringBuilder, Arrays, Math, and common APIs
- String manipulation and immutability
- StringBuilder vs StringBuffer
- Array operations
- Math class methods
- Date/Time API basics
Topics: Method declarations, overloading, varargs
- Method signatures and return types
- Method overloading rules
- Varargs (variable arguments)
- Access modifiers
- Static vs instance methods
Topics: Class inheritance, polymorphism, abstract classes
- extends keyword and inheritance hierarchy
- Method overriding vs overloading
- Abstract classes and methods
- Polymorphism and casting
- Object class methods
Topics: Interfaces, enums, nested classes, sealed classes
- Interface declarations and implementation
- Default and static methods in interfaces
- Private methods in interfaces
- Enums with constructors and methods
- Inner classes (static nested, inner, local, anonymous)
- Sealed classes (Java 17)
Topics: Lambda expressions, method references, built-in functional interfaces
- Lambda syntax and rules
- Functional interface definitions
- Method references (4 types)
- Built-in functional interfaces (Predicate, Consumer, Supplier, Function)
- Effectively final variables
- Lambda parameter syntax including
var(Java 11+)
Topics: Collection framework, generics, comparators
- Files:
CollectionsFramework.java- Overview of List, Set, Queue, MapListMethods.java- List operations and methodsSetMethods.java- Set implementations and methodsMapMethods.java- Map operations and methodsQueueAndDequeMethods.java- Queue/Deque operationsComparableAndComparator.java- Sorting and comparisonGenericsAndTypeErasure.java- Generic types and type erasureBoundingGenericTypes.java- Bounded wildcards (upper/lower bounds)
Topics: Stream API, intermediate and terminal operations
- Stream creation and operations
- map, filter, reduce, collect
- Optional class
- Primitive streams
- Stream pipeline evaluation
Topics: Exception handling, try-with-resources, localization
- Checked vs unchecked exceptions
- try-catch-finally blocks
- try-with-resources (AutoCloseable)
- Multi-catch blocks
- Custom exceptions
- Localization and resource bundles
Topics: Java Platform Module System (JPMS)
- Module declarations
- exports and requires
- Module types
- Module path vs classpath
- Service loading
Topics: Threads, concurrency utilities, parallel streams
- Thread creation and lifecycle
- ExecutorService and thread pools
- Concurrent collections
- Atomic classes
- Locks and synchronization
- Parallel streams
Topics: File I/O, NIO.2, serialization
- Files:
FileAndPathBasics.java- File and Path fundamentalsFilesOperations.java- Files class operationsNIO2Options.java- LinkOption, StandardCopyOption, StandardOpenOption- Stream-based I/O
- File operations and directory walking
Topics: Database connectivity, SQL operations, transactions
- Complete implementation with 7 files and comprehensive documentation
- Files:
JDBCBasics.java- JDBC URL, DriverManager, ConnectionPreparedStatementExamples.java- Execute methods, binding variablesResultSetExamples.java- Cursor navigation, gettersCallableStatementExamples.java- Stored procedures, IN/OUT/INOUTTransactionsAndSavepoints.java- Transactions, commit, rollback, savepointsClosingResources.java- Proper closing order, cascading closeJDBCExamReference.java- Quick reference guide
See: src/ch15jdbc/README.md for detailed setup and usage
Key Exam Points:
- JDBC URL format:
jdbc:subprotocol:subname - Execute methods:
executeUpdate(),executeQuery(),execute() - 1-based indexing (NOT 0-based!)
- ResultSet cursor starts BEFORE first row
- Closing order: ResultSet β PreparedStatement β Connection
- Cascading close behavior
- Transaction control and savepoints
JavaOCP17/
βββ src/
β βββ ch01buildingblocks/
β βββ ch02operators/
β βββ ch03controlflow/
β βββ ch04coreapis/
β βββ ch05methods/
β βββ ch06inheritance/
β βββ ch07beyondclasses/
β βββ ch08lambdasandfunctionalinterfaces/
β βββ ch09collectionsandgenerics/
β βββ ch10streams/
β βββ ch11exceptionsandlocalization/
β βββ ch12modules/
β βββ ch13concurrency/
β βββ ch14io/
β βββ ch15jdbc/ # Complete JDBC implementation
β β βββ README.md # Detailed JDBC setup and examples
β β βββ JDBCBasics.java
β β βββ PreparedStatementExamples.java
β β βββ ResultSetExamples.java
β β βββ CallableStatementExamples.java
β β βββ TransactionsAndSavepoints.java
β β βββ ClosingResources.java
β β βββ JDBCExamReference.java
β β βββ stored-procedures.sql
β β βββ setup-procedures.bat
β βββ ch16jdbc/ # Additional JDBC examples
βββ lib/
β βββ postgresql-42.7.1.jar # JDBC driver for examples
βββ docker-compose.yml # PostgreSQL database for JDBC
βββ init-db.sql # Database initialization
βββ README.md # This file
- Java 17 or higher
- Docker (for JDBC chapter examples)
- Git
git clone https://github.com/caseythecoder90/java-ocp-17-study.git
cd java-ocp-17-study# Compile all Java files
javac src/**/*.java
# Or compile specific chapter
javac src/ch09collectionsandgenerics/*.java# Run a specific example
java -cp src ch09collectionsandgenerics.BoundingGenericTypes
# For JDBC examples (requires classpath with driver)
java -cp "src;lib/*" ch15jdbc.JDBCBasicsJDBC examples require PostgreSQL running in Docker:
# Start database
docker-compose up -d
# Setup stored procedures (one-time)
docker exec -i jdbc-practice-db psql -U ocpuser -d ocp_practice < src/ch15jdbc/stored-procedures.sql
# Run JDBC examples
java -cp "src;lib/*" ch15jdbc.JDBCBasicsSee src/ch15jdbc/README.md for detailed instructions.
- Read the code: Each file has extensive documentation explaining concepts
- Run the examples: See the output and understand behavior
- Modify and experiment: Change values and see what happens
- Note the exam traps: Pay special attention to comments marked "EXAM TRAP!"
- Focus on comparison tables: Each chapter has tables comparing similar concepts
- Review exam traps: All common pitfalls are documented
- Practice with edge cases: Examples include boundary conditions
- Use quick reference files: Files like
JDBCExamReference.javafor rapid review
- Week 1-2: Chapters 1-5 (Fundamentals)
- Week 3-4: Chapters 6-8 (OOP and Lambdas)
- Week 5-6: Chapters 9-11 (Collections, Streams, Exceptions)
- Week 7-8: Chapters 12-14 (Modules, Concurrency, I/O)
- Week 9-10: Chapter 15 (JDBC) + Practice Exams
- Week 11: Review all exam traps and edge cases
- JDBC URL format:
jdbc:subprotocol:subname - Execute method return types
- 1-based indexing in JDBC (NOT 0-based)
- ResultSet cursor starts BEFORE first row
- Resource closing order (reverse of creation)
- AutoCloseable and try-with-resources
- Functional interface method counts
- Collection framework hierarchy
- Stream operations (intermediate vs terminal)
- Module system basics
- Confusing
executeUpdate()withexecuteQuery() - Using index 0 for JDBC parameters/columns
- Forgetting ResultSet cursor starts before first row
- Wrong closing order for JDBC resources
- Modifying effectively final variables in lambdas
- Confusing method overloading vs overriding
- Array vs Collection operations
- Checked vs unchecked exceptions
Every file includes:
- Detailed inline comments explaining each concept
- Comparison tables for similar methods/concepts
- Common exam traps clearly marked
- Edge cases and boundary conditions
- Expected output for each example
- Real exam scenarios: Examples mirror actual exam question patterns
- Edge cases: Boundary conditions and special cases covered
- Common mistakes: What NOT to do, with explanations
- Quick reference: Tables and summaries for rapid review
- All examples compile with Java 17
- All examples produce output (not just syntax demonstrations)
- JDBC examples use real database (PostgreSQL in Docker)
- No external dependencies except JDBC driver
- Don't just read, code: Type out examples yourself
- Understand the "why": Don't memorize, understand the reasoning
- Focus on exam traps: These are heavily tested
- Practice with real code: Run examples and modify them
- Use comparison tables: Great for quick review
- Review edge cases: Exam loves boundary conditions
- Time yourself: Practice answering questions quickly
To help you focus, here's what you can skip:
- SQL syntax errors (only JDBC API is tested)
- Statement interface (only PreparedStatement and CallableStatement)
- DataSource (only DriverManager)
- Batch updates
- Advanced concurrency patterns
- Complex regex patterns
- GUI development
- Network programming
Found an error or want to add examples? Contributions are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Commit your changes (
git commit -m 'Add improvement') - Push to the branch (
git push origin feature/improvement) - Open a Pull Request
Please ensure:
- Code compiles with Java 17
- Examples include comprehensive documentation
- Exam traps are clearly marked
- Output is demonstrated
- Total Java Files: 100+
- Chapters Covered: 15/15 (100%)
- Lines of Documentation: Thousands
- Working Examples: All files compile and run
- Exam Topics: Complete coverage
This repository was created as a comprehensive study guide for the Oracle Certified Professional Java SE 17 Developer exam. Examples and documentation are based on:
- Oracle's official Java SE 17 documentation
- OCP Java SE 17 Developer Study Guide
- Real exam practice questions and feedback
- Personal exam preparation experience
This repository is for educational purposes. Feel free to use for your exam preparation.
Good luck on your exam! Remember:
- Understand, don't memorize
- Practice with working code
- Focus on exam traps
- Review comparison tables
- Test edge cases
- Time management is key
For JDBC examples, see the detailed guide in src/ch15jdbc/README.md.
β If this repository helped you pass the exam, consider giving it a star!
Last Updated: January 2026 Exam: Oracle Certified Professional: Java SE 17 Developer (1Z0-829)