CodeGym
Promotion
CodeGym University
Java FullStack
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
  • Object initialization: initialization order

    JAVA 25 SELF
    Level 14, Lesson 5
    Step by step, we break down how Java initializes an object: default field values, explicit initialization, instance initialization blocks, and the final constructor call via new. Using the Person class as an example, we will see the actual print order, a table of default values, a flowchart, and typical mistakes (duplicating logic, expectations around static, working with null, calling a constructor via this(...)).
    Available
  • Debugging in IntelliJ IDEA

    JAVA 25 SELF
    Level 14, Lesson 6
    How to find bugs without losing your mind. Learning to use the Debugger: breakpoints, step-by-step execution, inspecting variables, and evaluating expressions on the fly.
    Available
  • Encapsulation principles and why they matter

    JAVA 25 SELF
    Level 15, Lesson 0
    In this lecture, we will figure out what encapsulation is in Java, how it is implemented using private fields ( private) and a public interface ( public methods), why you should hide the internal state of objects, and how this improves the reliability and maintainability of code. You will see bad and good examples, practical usage, a comparison table of approaches, and common mistakes.
    Available
  • Access modifiers

    JAVA 25 SELF
    Level 15, Lesson 1
    In this lecture, we break down access levels in Java: public, protected, package-private, and private. We’ll understand where and why to apply each one, how to protect fields (encapsulation), which rules to choose for methods and constructors, look at examples with packages and inheritance, and also cover best practices and common mistakes.
    Available
  • Getters and Setters: Syntax and Best Practices

    JAVA 25 SELF
    Level 15, Lesson 2
    In this lecture, you will learn how to use encapsulation and get/ set methods to control access to class fields in Java. You’ll learn the JavaBeans conventions, specifics for boolean fields with isXxx() getters, see examples of validation inside setters, safe handling of mutable fields, and automatic accessor generation in IDEs.
    Available
  • Initializing static and final fields

    JAVA 25 SELF
    Level 15, Lesson 3
    In this lecture you will learn how to initialize static fields ( static) and immutable fields ( final) in Java: at declaration, in a static initialization block, and in constructors. We’ll talk about the constant trio public static final, proper access to statics, the initialization order, and common mistakes to avoid.
    Available
  • Initialization blocks

    JAVA 25 SELF
    Level 15, Lesson 4
    In this lecture, you will understand initialization blocks in Java: how non-static and static blocks differ, the order in which fields, blocks, and constructors execute, when it’s appropriate to move shared logic into blocks, and when it’s better to use constructors. We’ll go through examples, inheritance nuances, and common pitfalls.
    Available
  • Inner classes (non-static inner)

    JAVA 25 SELF
    Level 16, Lesson 0
    Let’s unpack inner (non-static inner) classes in Java: what they are and how they are tied to an instance of the outer class, how to declare and create them via outer. new Inner(), how they gain access to members with private/ public modifiers, what restrictions exist (no static members except constants), as well as visibility options and practical examples: Backpack.Item, an iterator of your own collection, and referring to the outer object via OuterClassName. this. In the end—common mistakes and how to avoid them.
    Available
  • Static nested classes (static nested)

    JAVA 25 SELF
    Level 16, Lesson 1
    We break down static nested classes in Java: what they are, how they differ from inner classes, how to declare them with the static modifier, how to create instances without an instance of the outer class, and what access rules apply (no OuterClass.this, access only to static members). We’ll show practical scenarios— Builder, internal Node nodes in data structures, utilities—compare with inner classes, add a diagram, and go through typical mistakes: confusion with outer.new Inner() and the correct call new Outer.Nested().
    Available
  • Anonymous classes

    JAVA 25 SELF
    Level 16, Lesson 2
    In this lecture, we examine anonymous classes in Java: what they are, how they are declared and created at the point of use, how the compiler names their .class files, limitations (final/effectively final, no constructor, initializer blocks), and practical usage scenarios. We will show access to members of the enclosing class and go through common mistakes.
    Available
  • Local classes: declaring inside methods

    JAVA 25 SELF
    Level 16, Lesson 3
    We break down local classes in Java: what they are, how to declare them inside methods and blocks, what restrictions apply to modifiers and static members, and how access to method variables works (only final/ effectively final). We’ll compare them with anonymous classes, look at practical examples (a comparator, a temporary data structure, a mini test result), and typical mistakes. You’ll understand when a local class is more appropriate than an anonymous one and why it’s important to remember static and public/ private/ protected.
    Available
  • Introduction to generics

    JAVA 25 SELF
    Level 16, Lesson 4
    A practical introduction to Generics in Java: why storing in Object is risky, how to declare generic classes and methods, how to use Box<T>, pairs, and generic methods, and what advantages type safety provides without explicit casts. We’ll discuss limitations (primitives, type erasure) and go through usage examples.
    Available
  • 1
  • ...
  • 7
  • 8
  • 9
  • 10
  • 11
  • ...
  • 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