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.


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

Great work at working with methods!

Leave a Reply