CodeGym
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • module-info.java: syntax, creating modules

    JAVA 25 SELF
    Level 60, Lesson 1
    We examine what the module-info.java file is, where it lives in a project, and how to declare a module using the module keyword. We learn how to export an API via exports, add dependencies via requires, and also look at additional directives ( opens, uses, provides ... with). The lecture includes examples, module naming rules, a practical walkthrough of project structure, and common mistakes in modular builds.
    Available
  • Encapsulation via modules: export and import

    JAVA 25 SELF
    Level 60, Lesson 2
    How Java 9+ added modular encapsulation on top of classes and packages: even public classes are hidden until a package is explicitly exported via exports in module-info.java. We break down how to wire dependencies with requires, how to restrict visibility with exports to, how the module level differs from private/ public, and which compilation errors (for example, “package ... is not visible”, “cannot access ...”) hint that you forgot exports or requires.
    Available
  • Splitting a Project into Modules: Best Practices

    JAVA 25 SELF
    Level 60, Lesson 3
    A practical guide to modular architecture in Java: when and why to split code into modules, common patterns (onion architecture, api/ impl split, test modules), configuring dependencies via module-info.java and the requires/ exports keywords, working examples of a project with 3 modules, integration with Maven/ Gradle and IntelliJ IDEA, plus a breakdown of typical mistakes (cyclic dependencies, non-exported packages, incorrect --module-path).
    Available
  • Building multi-module projects: Maven, Gradle, IDEA

    JAVA 25 SELF
    Level 60, Lesson 4
    How to build a modular project in Java: the difference between classpath and module-path, when to use the --module-path flag, how to set up a multi-module structure in Maven and Gradle, and how to run everything from IntelliJ IDEA. We will show the module layout with module-info.java, dependencies via requires/ exports, plugin configuration, and common build errors.
    Available
  • ProcessBuilder — Launching External Processes

    JAVA 25 SELF
    Level 61, Lesson 0
    We break down how to launch external commands and utilities from Java using the ProcessBuilder class: why it’s better than Runtime. getRuntime(). exec(), how to set the working directory via directory(), environment variables via environment(), and control the process via start(), waitFor(), the streams getInputStream()/ getErrorStream()/ getOutputStream(). We’ll discuss cross-platform concerns ( cmd.exe/ ls), working with stdout/ stderr, and common pitfalls.
    Available
  • Reading process output, working with stdin/stdout

    JAVA 25 SELF
    Level 61, Lesson 1
    Practice working with external processes in Java: how to read stdout via Process.getInputStream(), capture errors from stderr via Process.getErrorStream(), write to stdin using Process.getOutputStream(), and also use the convenient inputReader()/ errorReader()/ outputWriter() methods. We’ll cover quirks of commands like java -version, reading both streams in parallel to avoid deadlock, working with encodings ( "UTF-8"), and a small bridge with Python scripts.
    Available
  • Managing the Process Life Cycle

    JAVA 25 SELF
    Level 61, Lesson 2
    Hands-on management of external processes from Java: wait for completion via waitFor() (including timeouts), read the exit code, stop correctly via destroy()/ destroyForcibly(), prevent hangs and “zombie” processes, and don’t forget about output streams and exceptions. We cover cross-platform nuances and common mistakes.
    Available
  • Interactive communication with processes

    JAVA 25 SELF
    Level 61, Lesson 3
    In this lecture, we will explore how to set up a “live” dialogue with external programs from Java: write to stdin, read from stdout and stderr, avoid mutual blocking ( deadlock), process output concurrently with ExecutorService, close streams properly, and manage the lifecycle of a Process via ProcessBuilder. We will look at examples with an interactive Python script and the bc utility, and we will examine buffering pitfalls and the need for flush().
    Available
  • A breakdown of common mistakes when working with processes

    JAVA 25 SELF
    Level 61, Lesson 4
    A practical guide to robust work with external processes in Java: how to avoid hangs due to unread stdout/ stderr streams, correctly configure output encodings (e.g., UTF-8, CP866), account for cross-platform command differences ( ls vs dir), handle permissions and exit codes via process.exitValue(), close resources without leaks, and avoid interactive deadlocks. We consider proper use of ProcessBuilder, parallel stream reading (threads/ ExecutorService), graceful termination via process.destroy(), as well as portable paths with File.separator.
    Available
  • Introduction to reflection: the Class class, why it’s needed

    JAVA 25 SELF
    Level 62, Lesson 0
    We’ll break down what reflection in Java is and why frameworks and tools need it, how the Class object — the heart of reflection — works, and the ways to obtain it: via .class, getClass(), and Class.forName(). We’ll discuss when to use reflection and when to avoid it, look at examples of obtaining metadata (name, package, superclass, interfaces), dissect a mini‑utility “What class is it?” and common pitfalls ( ClassNotFoundException, performance, security).
    Available
  • Getting information about classes, fields, and methods

    JAVA 25 SELF
    Level 62, Lesson 1
    In this lecture we explore reflection in Java: how to use the Class API to obtain details about fields ( getFields()/ getDeclaredFields()), methods ( getMethods()/ getDeclaredMethods()), constructors ( getConstructors()/ getDeclaredConstructors()), and annotations ( getAnnotations()). We’ll learn about modifiers via Modifier ( public, private, protected, static, final), discuss the differences “public vs declared,” build a small class inspector utility, and look at a visual diagram.
    Available
  • Security, limitations, and alternatives to reflection

    JAVA 25 SELF
    Level 62, Lesson 2
    In this lecture we break down the risks and limitations of reflection: bypassing encapsulation via setAccessible( true), attempts to mutate final fields and why this is dangerous because of JVM optimizations; the fate of SecurityManager and how the module system (Java 9+) leads to InaccessibleObjectException. We will talk about performance and type-safety loss, modern alternatives ( record, sealed, pattern matching, APT, DI) and best practices. At the end — a practical example with the JVM parameter --add-opens.
    Available
  • 1
  • ...
  • 26
  • 27
  • 28
  • 29
  • 30
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym