1 min read
Creating and calling methods Part 3 – Initialize two objects and call the method
Now create two new motorcycles.
Motorcycle racer1 = new Motorcycle();
racer1.Color = "green";
Motorcycle racer2 = new Motorcycle();
racer2.Color = "blue";
And call the method in the class.
racer1.StartEngine();
racer2.StartEngine();

Now run the application and watch them drive on the racetrack!

Great work at working with methods!