Learn
Classes
Review

Excellent work! In this lesson, we’ve learned the following concepts:

  • A class is an object-oriented concept which resembles a blueprint for individual objects. A class can contain properties and functions and is defined using the class keyword followed by a name and optional body.
  • An instance is a member of a class created by calling the class name followed by a pair of parentheses, (), and any necessary arguments.
  • We can use dot syntax to access the value of each class property.
  • A class can have properties with default values or ones that are customizable with the help of primary constructors.
  • A primary constructor allows us to set each property value when we instantiate an object.
  • The init block gets invoked with every instance creation and is used to add logic to the class.
  • A function declared within a Kotlin class is known as a member function of that class. In order to invoke a member function, we must call the function on an instance of the class.

Instructions

You did it! 🎉 You’ve completed the last lesson in the Learn Kotlin course. You should be immensely proud of yourself and your accomplishments. This was no easy feat, but you’ve made it to DevCity and can proudly say you’re on track to becoming a master of the Kotlin language.

Run the code on the right and enter the following two commands for a special message from Codey:

kotlinc Congratulations.kt -include-runtime -d Congratulations.jar
java -jar Congratulations.jar
Folder Icon

Take this course for free

Already have an account?