Classes
Get introduced to the world of object-oriented programming in Kotlin and learn how to create classes and objects.
StartKey Concepts
Review core concepts you need to learn to master this subject
Classes
Classes
// A class with properties that contain default values
class Student {
var name = "Lucia"
var semester = "Fall"
var gpa = 3.95
}
// Shorthand syntax with no class body
class Student
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.
If the class does not have a body, its curly braces can be omitted.
Classes
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory