Programming and Problem Solving
Theme: The Avengers' JARVIS System - Building Tony Stark's AI Assistant
- 1.1.1 James Gosling and the Green Team
- 1.1.2 From Set-Top Boxes to the Internet
- 1.1.3 "Write Once, Run Anywhere" Philosophy
- 1.1.4 Java's Evolution Through Versions
- 1.2.1 Enterprise Applications and Android
- 1.2.2 Platform Independence
- 1.2.3 Strong Type Safety and Security
- 1.2.4 Massive Ecosystem and Community
- 1.3.1 Downloading and Installing JDK 21
- 1.3.2 Setting JAVA_HOME and PATH Variables
- 1.3.3 Verifying Your Installation
- 1.3.4 Choosing a Text Editor or IDE
- 1.4.1 JVM: The Magic Box That Runs Java
- 1.4.2 JRE: Runtime Environment Components
- 1.4.3 JDK: Developer Tools and Compilers
- 1.4.4 How They Work Together
- 1.5.1 Creating JarvisGreeting.java
- 1.5.2 The main Method: Program Entry Point
- 1.5.3 System.out.println Explained
- 1.5.4 Adding User Input with Scanner
- 1.6.1 Package Declarations
- 1.6.2 Import Statements
- 1.6.3 Class Definitions
- 1.6.4 Comments and Documentation
- 1.7.1 The javac Compiler
- 1.7.2 Understanding Bytecode
- 1.7.3 The java Command
- 1.7.4 Classpath and Package Structure
- 1.8.1 Missing Semicolons and Braces
- 1.8.2 Case Sensitivity Issues
- 1.8.3 File Name vs. Class Name Mismatches
- 1.8.4 Forgetting public static void main
- 1.9.1 IntelliJ IDEA Setup and Features
- 1.9.2 Eclipse and VS Code Alternatives
- 1.9.3 IDE Debugging Tools
- 1.9.4 When to Use Command Line
- 1.10.1 Virtual Threads Teaser
- 1.10.2 Pattern Matching Improvements
- 1.10.3 String Templates Preview
- 1.10.4 What's Coming Next
Theme: TMNT Pizza Restaurant - Managing Orders and Inventory
- 2.1.1 byte and short: Small Numbers for Pizza Slices
- 2.1.2 int: Counting Pizzas and Customers
- 2.1.3 long: Tracking Total Sales
- 2.1.4 float and double: Prices and Measurements
- 2.2.1 Variable Declaration and Initialization
- 2.2.2 Naming Conventions: camelCase Rules
- 2.2.3 Meaningful Names: pizzaCount vs. p
- 2.2.4 Variable Scope and Lifetime
- 2.3.1 When to Use var
- 2.3.2 var Limitations and Restrictions
- 2.3.3 Readability Considerations
- 2.3.4 var with Collections and Loops
- 2.4.1 Defining Pizza Sizes as Constants
- 2.4.2 final Variables vs. final Methods
- 2.4.3 Static Final Constants
- 2.4.4 Naming Constants: UPPER_SNAKE_CASE
- 2.5.1 Implicit Casting: Widening
- 2.5.2 Explicit Casting: Narrowing
- 2.5.3 Casting Between Numeric Types
- 2.5.4 Loss of Precision Warnings
- 2.6.1 Binary, Octal, and Hexadecimal
- 2.6.2 Using Underscores for Readability
- 2.6.3 Scientific Notation
- 2.6.4 Literal Type Suffixes (L, F, D)
- 2.7.1 char Type and Single Quotes
- 2.7.2 Unicode Escape Sequences
- 2.7.3 Special Characters (\n, \t, \)
- 2.7.4 Character Arithmetic
- 2.8.1 boolean Variables for Pizza Availability
- 2.8.2 Logical Operators: &&, ||, !
- 2.8.3 Short-Circuit Evaluation
- 2.8.4 Boolean Expressions in Conditions
- 2.9.1 What null Means in Java
- 2.9.2 NullPointerException: The Common Enemy
- 2.9.3 Checking for null Values
- 2.9.4 Alternatives to null
- 2.10.1 Stack vs. Heap Memory
- 2.10.2 Primitive Types in Memory
- 2.10.3 Garbage Collection Preview
- 2.10.4 Memory Efficiency Tips
Theme: Mario's Plumbing Business - Scheduling and Routing Decisions
- 3.1.1 Basic if Statement Structure
- 3.1.2 if-else: Choosing Between Paths
- 3.1.3 else if: Multiple Conditions
- 3.1.4 Nested if Statements for Complex Routing
- 3.2.1 Traditional switch Statements
- 3.2.2 Switch Expressions with Arrow Syntax
- 3.2.3 Yield Keyword for Complex Cases
- 3.2.4 No Fall-Through Behavior
- 3.3.1 Type Patterns in Switch
- 3.3.2 Guarded Patterns with when
- 3.3.3 Pattern Variables
- 3.3.4 Exhaustiveness Checking
- 3.4.1 Basic Ternary Syntax
- 3.4.2 When to Use Ternary vs. if-else
- 3.4.3 Nested Ternary Operations
- 3.4.4 Readability Considerations
- 3.5.1 while Loop Structure
- 3.5.2 Loop Control Variables
- 3.5.3 Infinite Loops and How to Avoid Them
- 3.5.4 While Loops for User Input Validation
- 3.6.1 Classic For Loop Anatomy
- 3.6.2 Loop Variable Initialization
- 3.6.3 Multiple Variables in For Loops
- 3.6.4 For Loop Best Practices
- 3.7.1 Iterating Over Arrays
- 3.7.2 For-Each with Collections
- 3.7.3 Read-Only Nature of For-Each
- 3.7.4 When to Use For-Each vs. Traditional For
- 3.8.1 do-while Structure
- 3.8.2 Guaranteed First Execution
- 3.8.3 Menu-Driven Programs
- 3.8.4 Input Validation Patterns
- 3.9.1 break: Emergency Exit
- 3.9.2 continue: Skip to Next Iteration
- 3.9.3 Labeled Breaks for Nested Loops
- 3.9.4 When Labels Are Appropriate
- 3.10.1 Two-Dimensional Iterations
- 3.10.2 Time Complexity Basics
- 3.10.3 Optimizing Nested Loops
- 3.10.4 Alternative Approaches
Theme: Dorothy's Travel Agency - Managing Tours, Destinations, and Bookings
- 4.1.1 Declaring and Creating Arrays
- 4.1.2 Array Initialization Techniques
- 4.1.3 Accessing Array Elements
- 4.1.4 Array Length and Bounds Checking
- 4.2.1 2D Arrays for Seating Charts
- 4.2.2 Jagged Arrays
- 4.2.3 3D and Higher Dimensions
- 4.2.4 Iterating Through Multidimensional Arrays
- 4.3.1 Arrays.sort() for Destinations
- 4.3.2 Arrays.binarySearch()
- 4.3.3 Arrays.equals() and Arrays.deepEquals()
- 4.3.4 Arrays.fill() and Arrays.copyOf()
- 4.4.1 Collection Interface Hierarchy
- 4.4.2 Generics Basics
- 4.4.3 Autoboxing and Unboxing
- 4.4.4 Common Collection Operations
- 4.5.1 ArrayList for Tour Participants
- 4.5.2 LinkedList for Itineraries
- 4.5.3 Performance Characteristics
- 4.5.4 Choosing the Right List Implementation
- 4.6.1 HashSet for Unique Destinations
- 4.6.2 TreeSet for Sorted Collections
- 4.6.3 LinkedHashSet for Ordered Uniqueness
- 4.6.4 Set Operations: Union, Intersection
- 4.7.1 HashMap for Booking References
- 4.7.2 TreeMap for Sorted Mappings
- 4.7.3 Map Methods: put, get, remove
- 4.7.4 Iterating Over Maps
- 4.8.1 Queue for Booking Requests
- 4.8.2 PriorityQueue for VIP Processing
- 4.8.3 Deque as Stack and Queue
- 4.8.4 ArrayDeque vs. LinkedList
- 4.9.1 Performance Characteristics Table
- 4.9.2 Memory Overhead Considerations
- 4.9.3 Thread Safety Requirements
- 4.9.4 Decision Tree for Collection Selection
- 4.10.1 List.of() and Set.of()
- 4.10.2 Map.of() and Map.ofEntries()
- 4.10.3 Benefits of Immutability
- 4.10.4 Converting Mutable to Immutable
Theme: Hogwarts School Management System - Spells as Methods
- 5.1.1 Method Signature Components
- 5.1.2 Access Modifiers for Methods
- 5.1.3 Return Types and void
- 5.1.4 Method Body and Logic
- 5.2.1 Formal Parameters vs. Actual Arguments
- 5.2.2 Pass-by-Value in Java
- 5.2.3 Passing Objects and References
- 5.2.4 Parameter Validation
- 5.3.1 Returning Primitive Values
- 5.3.2 Returning Objects
- 5.3.3 Multiple Exit Points
- 5.3.4 void Methods for Side Effects
- 5.4.1 Overloading Rules and Restrictions
- 5.4.2 Parameter Type Differences
- 5.4.3 Parameter Count Variations
- 5.4.4 Overloading Best Practices
- 5.5.1 Varargs Syntax (Type... args)
- 5.5.2 Combining Regular and Varargs Parameters
- 5.5.3 Varargs Under the Hood
- 5.5.4 When to Use Varargs
- 5.6.1 Base Case and Recursive Case
- 5.6.2 Stack Overflow Dangers
- 5.6.3 Tail Recursion Optimization
- 5.6.4 Recursion vs. Iteration
- 5.7.1 When to Use Static Methods
- 5.7.2 Utility Classes and Static Methods
- 5.7.3 Instance Method Access to Fields
- 5.7.4 Method References to Static Methods
- 5.8.1 Four Types of Method References
- 5.8.2 Constructor References
- 5.8.3 Instance Method References
- 5.8.4 Method References vs. Lambdas
- 5.9.1 Method-Local Variables
- 5.9.2 Variable Shadowing
- 5.9.3 Block Scope
- 5.9.4 Effectively Final Variables
- 5.10.1 Single Responsibility Principle
- 5.10.2 Method Length Guidelines
- 5.10.3 Naming Conventions
- 5.10.4 Documentation with Javadoc
Theme: Pokemon Training Center - Creatures as Objects
- 6.1.1 Real-World Modeling
- 6.1.2 State and Behavior
- 6.1.3 Objects vs. Classes
- 6.1.4 Benefits of OOP
- 6.2.1 Class Declaration Syntax
- 6.2.2 File Organization
- 6.2.3 Package Declarations
- 6.2.4 Import Statements in Classes
- 6.3.1 Declaring Instance Variables
- 6.3.2 Default Values for Fields
- 6.3.3 Field Initialization
- 6.3.4 Instance vs. Local Variables
- 6.4.1 Default Constructor
- 6.4.2 Parameterized Constructors
- 6.4.3 Constructor Overloading
- 6.4.4 Constructor Chaining with this()
- 6.5.1 Disambiguating Field Names
- 6.5.2 Passing Current Object
- 6.5.3 Method Chaining Pattern
- 6.5.4 this in Constructors
- 6.6.1 private: Internal Only
- 6.6.2 public: Open to All
- 6.6.3 protected: Family Access
- 6.6.4 Package-Private (Default)
- 6.7.1 Why Hide Fields
- 6.7.2 Getter Method Conventions
- 6.7.3 Setter Method Validation
- 6.7.4 Read-Only and Write-Only Properties
- 6.8.1 Static Fields for Shared Data
- 6.8.2 Static Methods
- 6.8.3 Static Initialization Blocks
- 6.8.4 Static Import Statements
- 6.9.1 Record Syntax and Components
- 6.9.2 Automatic Methods
- 6.9.3 Compact Constructors
- 6.9.4 When to Use Records
- 6.10.1 Sealed Class Declaration
- 6.10.2 Permitted Subclasses
- 6.10.3 Sealed Interfaces
- 6.10.4 Design Benefits
Theme: Superhero Academy - Heroes Inheriting Powers
- 7.1.1 The "is-a" Relationship
- 7.1.2 Inheritance Hierarchy
- 7.1.3 Single Inheritance in Java
- 7.1.4 Object as Universal Parent
- 7.2.1 Extending a Base Class
- 7.2.2 Inherited Members
- 7.2.3 What's Not Inherited
- 7.2.4 Multi-Level Inheritance
- 7.3.1 @Override Annotation
- 7.3.2 Overriding Rules
- 7.3.3 Covariant Return Types
- 7.3.4 Cannot Override final Methods
- 7.4.1 super in Constructors
- 7.4.2 Calling Parent Methods
- 7.4.3 Accessing Parent Fields
- 7.4.4 Constructor Chaining with super()
- 7.5.1 abstract Keyword
- 7.5.2 Abstract Methods
- 7.5.3 Concrete Methods in Abstract Classes
- 7.5.4 When to Use Abstract Classes
- 7.6.1 Interface Declaration
- 7.6.2 Implementing Interfaces
- 7.6.3 Multiple Interface Implementation
- 7.6.4 Interface Constants
- 7.7.1 Default Method Syntax
- 7.7.2 Resolving Default Method Conflicts
- 7.7.3 Static Interface Methods
- 7.7.4 Private Interface Methods (Java 9+)
- 7.8.1 Diamond Problem Avoidance
- 7.8.2 Interface Inheritance
- 7.8.3 Combining Multiple Behaviors
- 7.8.4 Marker Interfaces
- 7.9.1 Compile-Time vs. Runtime Types
- 7.9.2 Method Dispatch
- 7.9.3 Polymorphic Arrays and Collections
- 7.9.4 Benefits of Polymorphism
- 7.10.1 Traditional instanceof
- 7.10.2 Pattern Matching instanceof
- 7.10.3 Pattern Variables
- 7.10.4 Combining with Control Flow
Theme: Space Station Management - Handling System Failures
- 8.1.1 The Throwable Hierarchy
- 8.1.2 Error vs. Exception
- 8.1.3 When Exceptions Occur
- 8.1.4 Stack Traces
- 8.2.1 Basic try-catch Syntax
- 8.2.2 Catching Specific Exceptions
- 8.2.3 Multiple catch Blocks
- 8.2.4 Multi-catch with | (Java 7+)
- 8.3.1 Common Runtime Exceptions
- 8.3.2 Common Checked Exceptions
- 8.3.3 Exception Inheritance
- 8.3.4 Catching Parent vs. Child
- 8.4.1 throw Statement
- 8.4.2 throws Declaration
- 8.4.3 Rethrowing Exceptions
- 8.4.4 Exception Wrapping
- 8.5.1 Compile-Time Checking
- 8.5.2 RuntimeException Family
- 8.5.3 Handling Requirements
- 8.5.4 Design Considerations
- 8.6.1 finally Syntax
- 8.6.2 Resource Cleanup
- 8.6.3 finally vs. catch
- 8.6.4 Return in finally
- 8.7.1 AutoCloseable Interface
- 8.7.2 Resource Declaration
- 8.7.3 Multiple Resources
- 8.7.4 Suppressed Exceptions
- 8.8.1 Extending Exception Classes
- 8.8.2 Custom Exception Fields
- 8.8.3 Constructor Patterns
- 8.8.4 When to Create Custom Exceptions
- 8.9.1 Cause Chain
- 8.9.2 initCause() Method
- 8.9.3 getSuppressed() Method
- 8.9.4 Debugging with Chains
- 8.10.1 Catch Early or Late?
- 8.10.2 Logging Exceptions
- 8.10.3 User-Friendly Error Messages
- 8.10.4 Exception Performance
Theme: Wizard's Library - Spell Books and Magical Texts
- 9.1.1 String Literal Pool
- 9.1.2 String Object Creation
- 9.1.3 Immutability Benefits
- 9.1.4 String Interning
- 9.2.1 length(), charAt(), substring()
- 9.2.2 indexOf(), lastIndexOf()
- 9.2.3 toUpperCase(), toLowerCase()
- 9.2.4 trim(), strip() (Java 11+)
- 9.3.1 Mutable String Building
- 9.3.2 append() Methods
- 9.3.3 insert(), delete(), reverse()
- 9.3.4 StringBuffer vs. StringBuilder
- 9.4.1 Format Specifiers
- 9.4.2 Width and Precision
- 9.4.3 Date and Time Formatting
- 9.4.4 Locale-Specific Formatting
- 9.5.1 Triple-Quote Syntax
- 9.5.2 Incidental Whitespace
- 9.5.3 Escape Sequences in Text Blocks
- 9.5.4 Text Block Methods
- 9.6.1 Pattern and Matcher Classes
- 9.6.2 Common Regex Patterns
- 9.6.3 Capturing Groups
- 9.6.4 String split() and replaceAll()
- 9.7.1 Template Expression Syntax
- 9.7.2 Template Processors
- 9.7.3 Custom Processors
- 9.7.4 Security Benefits
- 9.8.1 UTF-8 and UTF-16
- 9.8.2 Charset Class
- 9.8.3 Encoding and Decoding
- 9.8.4 Handling Different Encodings
- 9.9.1 Reference vs. Value Equality
- 9.9.2 equalsIgnoreCase()
- 9.9.3 compareTo() for Ordering
- 9.9.4 Null-Safe Comparisons
- 9.10.1 How String Pool Works
- 9.10.2 intern() Method
- 9.10.3 Memory Implications
- 9.10.4 Performance Considerations
Theme: Music Festival Organizer - Processing Playlists and Artists
- 10.1.1 Lambda Syntax Basics
- 10.1.2 Type Inference in Lambdas
- 10.1.3 Capturing Variables
- 10.1.4 Lambda vs. Anonymous Classes
- 10.2.1 @FunctionalInterface Annotation
- 10.2.2 Built-in Functional Interfaces
- 10.2.3 Function, Consumer, Supplier, Predicate
- 10.2.4 Creating Custom Functional Interfaces
- 10.3.1 Creating Streams from Collections
- 10.3.2 Stream Pipeline Concept
- 10.3.3 Lazy Evaluation
- 10.3.4 Stream vs. Collection
- 10.4.1 Stream.of() and Arrays.stream()
- 10.4.2 Infinite Streams
- 10.4.3 Stream.Builder
- 10.4.4 Files and I/O Streams
- 10.5.1 Filtering Festival Artists
- 10.5.2 Mapping Song Durations
- 10.5.3 FlatMap for Nested Data
- 10.5.4 distinct(), sorted(), limit()
- 10.6.1 Collecting to Lists and Sets
- 10.6.2 Reducing to Single Values
- 10.6.3 forEach vs. Traditional Loops
- 10.6.4 Finding and Matching
- 10.7.1 parallelStream() Method
- 10.7.2 When to Use Parallel Streams
- 10.7.3 Thread Safety Concerns
- 10.7.4 Performance Considerations
- 10.8.1 Creating Optional Values
- 10.8.2 isPresent() and isEmpty()
- 10.8.3 map() and flatMap() on Optional
- 10.8.4 orElse() and orElseThrow()
- 10.9.1 groupingBy() for Categorization
- 10.9.2 partitioningBy() for Binary Split
- 10.9.3 joining() Strings
- 10.9.4 Custom Collectors
- 10.10.1 Stream Overhead
- 10.10.2 Primitive Streams
- 10.10.3 Short-Circuiting Operations
- 10.10.4 Benchmarking Streams
Theme: Restaurant Kitchen Simulator - Multiple Chefs Working Together
- 11.1.1 What is a Thread?
- 11.1.2 Main Thread
- 11.1.3 Thread vs. Process
- 11.1.4 Benefits of Multithreading
- 11.2.1 Extending Thread Class
- 11.2.2 Implementing Runnable
- 11.2.3 Lambda Expressions with Runnable
- 11.2.4 Starting and Naming Threads
- 11.3.1 NEW, RUNNABLE, BLOCKED
- 11.3.2 WAITING, TIMED_WAITING
- 11.3.3 TERMINATED State
- 11.3.4 Thread State Transitions
- 11.4.1 synchronized Keyword
- 11.4.2 Synchronized Methods
- 11.4.3 Synchronized Blocks
- 11.4.4 Monitor Locks
- 11.5.1 ReentrantLock Class
- 11.5.2 tryLock() Method
- 11.5.3 Deadlock Scenarios
- 11.5.4 Deadlock Prevention Strategies
- 11.6.1 ExecutorService Interface
- 11.6.2 Fixed vs. Cached Thread Pools
- 11.6.3 ScheduledExecutorService
- 11.6.4 Shutting Down Executors
- 11.7.1 Creating CompletableFutures
- 11.7.2 Chaining Async Operations
- 11.7.3 Combining Multiple Futures
- 11.7.4 Exception Handling in Futures
- 11.8.1 Virtual vs. Platform Threads
- 11.8.2 Creating Virtual Threads
- 11.8.3 Performance Benefits
- 11.8.4 Migration from Traditional Threads
- 11.9.1 ConcurrentHashMap
- 11.9.2 CopyOnWriteArrayList
- 11.9.3 BlockingQueue Implementations
- 11.9.4 Concurrent Collection Performance
- 11.10.1 Producer-Consumer Pattern
- 11.10.2 Reader-Writer Pattern
- 11.10.3 Thread-Local Storage
- 11.10.4 Common Mistakes to Avoid
Theme: Startup Incubator - Building Various Business Applications
- 12.1.1 File and Path Classes
- 12.1.2 Reading Files with Files Class
- 12.1.3 Writing and Appending
- 12.1.4 Directory Operations
- 12.2.1 JSON Libraries Overview
- 12.2.2 Parsing JSON Data
- 12.2.3 XML Processing Options
- 12.2.4 Data Binding Techniques
- 12.3.1 JDBC Driver Setup
- 12.3.2 Connection Management
- 12.3.3 Prepared Statements
- 12.3.4 Result Set Processing
- 12.4.1 HTTP Basics Review
- 12.4.2 REST Principles
- 12.4.3 Simple HTTP Server (Java 18+)
- 12.4.4 JSON Response Handling
- 12.5.1 JUnit 5 Setup
- 12.5.2 Writing Test Methods
- 12.5.3 Assertions and Matchers
- 12.5.4 Test Lifecycle Methods
- 12.6.1 Project Structure
- 12.6.2 Dependency Declaration
- 12.6.3 Build Lifecycle
- 12.6.4 Publishing Artifacts
- 12.7.1 Java Logging API
- 12.7.2 Log Levels and Configuration
- 12.7.3 Debugging with IDE
- 12.7.4 Remote Debugging
- 12.8.1 JVM Monitoring Tools
- 12.8.2 Memory Profiling
- 12.8.3 CPU Profiling
- 12.8.4 Optimization Strategies
- 12.9.1 Creating JAR Files
- 12.9.2 Executable JARs
- 12.9.3 Java Modules (JPMS)
- 12.9.4 Distribution Options
- 12.10.1 Spring Framework Overview
- 12.10.2 Microservices Architecture
- 12.10.3 Cloud Deployment
- 12.10.4 Continuing Your Java Journey
- Sherlock Holmes Detective Agency - Pattern matching and deduction systems
- Jurassic Park Management - Inheritance hierarchies with dinosaurs
- Star Wars Spaceship Fleet - Interfaces for different ship capabilities
- Netflix Clone - Streaming and collection management
- Pokemon Go Location Tracker - GPS and real-time updates
- Minecraft Inventory System - Complex item management
- Twitter/X Clone - Concurrent user interactions
- Uber Ride Sharing - Real-time matching algorithms
- Weather Station Network - Data collection and analysis
- Stock Trading Platform - High-performance concurrent processing
- Library Management System - Classic CRUD operations
- Gaming Tournament Organizer - Bracket systems and scoring
- Food Delivery Service - Order routing and optimization
- Social Media Analytics - Stream processing of posts
- Online Banking System - Security and transaction management