...

/

Create Objects

Create Objects

Build an object to store and print a player’s attributes.

Now that you’ve defined a class, let’s see how to create objects using a constructor—a special method that sets things up for you.

Goal

You’ll aim to:

  • Use constructors to initialize objects.

  • Understand this keyword.

  • Build multiple objects easily.

Press + to interact
Class vs. objects
Class vs. objects

Add a constructor

...