Defining a Class With Fields
Bundle state into a class.
What a Class Is
A class is a blueprint for your own data type. It bundles related values together so you can model real things in code.
Your First Class
Declare a class with the class keyword and a capitalized name. The body, even if empty for now, lives inside the curly braces.
class Dog {
}All lessons in this course
- Defining a Class With Fields
- Instance Methods and this
- Getters and Setters
- Static Members and Class Constants