Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Objects Object-Oriented Programming Instantiation

Create a Frog instance in Program.Main() and assign it to a variable named mike.

i couldn't figure out this

Program.cs
namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {            
         Frog mike = new Frog(mike) ;
        }
    }
}
Frog.cs
namespace Treehouse.CodeChallenges
{
  class Frog
  {
    public string name;

    {name = name;}
  }
}

try with this,
Frog mike = new Frog(); it worked for me.

5 Answers

Seth Kroger
Seth Kroger
56,403 Points

The first part of the challenge is just to create an empty class named Frog, so it doesn't need any names or fields.

class Frog {}

Then when you're asked to create a new one, you make a new frog without passing any arguments like this:

Frog mike = new Frog();
//  or
var mike = new Frog();
Richard Wood
Richard Wood
1,990 Points

hmm. I had this exact answer typed but it didn't work.? Then I tried to copy & paste directly in. Still no good. I'm tempted to believe there may be some error?

namespace Treehouse.CodeChallenges { class Frog { } } ***Update* I just reset the code. It seemed to fix the problem.

I'm so sure that what im doing is correct but still having this problem. how to pass it!

Pedro Suarez
Pedro Suarez
993 Points

also spaces do count so make sure just to leave one space at most otherwise the code will not work

Fradely Dilone
Fradely Dilone
23,878 Points

FROG.CS

namespace Treehouse.CodeChallenges { class Frog{

}

}

PROGRAM.CS

namespace Treehouse.CodeChallenges { class Program { static void Main() {
var mike = new Frog(); } } }