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 trialinnocent sibanda
770 Pointsinstantiation
what's wrong with my code? can you help
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
Frog frog= new mike();
}
}
}
namespace Treehouse.CodeChallenges
{
class Frog
{
}
}
2 Answers
Shadab Khan
5,470 PointsHi,
'mike' has to be an object (instance) of class Frog. When you say, new mike(), you're creating an object of class mike, which doesn't exists.
In Program.cs, your code should look like below :
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
Frog mike = new Frog();
}
}
}
Let me know if you have further questions. All the best!
Chris Jones
Java Web Development Techdegree Graduate 23,933 PointsHey Innocent,
You need to change the frog
variable to mike
per the instructions. So, your code should be:
Frog mike = new Frog();
new Frog()
is creating a new Frog object using the Frog class as a template/cookie cutter, so to speak. You don't have a class called mike
, so you can't say new mike()
.
I hope that helps! Let me know if you have any more questions!