CodeGym
AI Academy
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
  • Why classes exist and how to think in objects: your own type and references

    Kotlin SELF
    Level 30, Lesson 0
    We break down why Kotlin needs classes and how to “glue” data into meaningful entities: why a couple of variables ( title and amount) quickly turns into chaos, why Pair is convenient and why it’s dangerous, how to create your own type ( class Expense), and how references to objects work: assignment copies the reference, the difference between val and var, and how to debug “weird changes” by checking ===.
    Available
  • Class syntax: primary constructor, properties in the header, default values

    Kotlin SELF
    Level 30, Lesson 1
    We break down class syntax in Kotlin: how primary constructor works, why parameters without val/ var do not become properties, how to create objects without new, set default values, use named arguments, and format a “readable” class header. At the end: migration from Pair to the Expense model and common mistakes.
    Available
  • Methods and state: behavior next to data, this, and basic checks

    Kotlin SELF
    Level 30, Lesson 2
    We break down why, in OOP, it’s beneficial to keep behavior next to data: we move “external” functions into the class as methods, learn to call them with dot syntax, and understand why methods can “see” an object’s properties. Separately, we discuss mutable state via var, the nuance of a val reference, the role of this when names conflict, as well as invariants and checks via an early return, require/ check — so that an object remains valid even with incorrect input.
    Available
  • Object collections: MutableList<Expense>, operations, and migration from Pair

    Kotlin SELF
    Level 30, Lesson 3
    We break down why domain data is better stored not in Pair<String, Int>, but in a separate class Expense; we learn to build and modify MutableList<Expense>, print elements with indices, safely delete via removeAt(), build reports with filter()/ map()/ sortedByDescending()/ fold(), and also create a mini CLI and a bridge for a “soft” migration from pairs to objects.
    Available
  • Common OOP start-up mistakes: mutability, references, responsibility, names

    Kotlin SELF
    Level 30, Lesson 4
    We go through the most common pitfalls when taking the first steps in OOP with Kotlin: why uncontrolled var turns a model into jelly, how val protects a reference but not an object, how shared references break expectations in MutableList<Expense>, why the Expense entity should not know about readln()/ println(), and how good names make code shorter and clearer. At the end: a mini-refactoring of BudgetBuddy and a block of typical mistakes.
    Available
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