Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Munoz
Front End Web Development Techdegree Student 1,922 PointsWhy do we say map Map = new map? I couldn't find the part where this was introduced.
Sorry if this is an obvious question. What does each map stand for and why is one capitalized? thank you
1 Answer
<noob />
17,062 Pointsin C# and in other programming languages u instaniate an object with the keyword "new" followed by the name of the object ur instatiating. for example i have class named "Car". to get access to the "Car" class methods in another file ill need to create a new object of type Car.
Car variableName = new Car();
lets say i have a method called "drive". because i have i created an object of type Car i can use it like that:
variableName.drive();
``
Peter McClory
2,365 PointsPeter McClory
2,365 PointsJust to clarify, it should be:
Map map = new Map();
The capitalisation is important so that you know that you are making an instance of the
Map
class and assigning it to the variablemap
.