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 trial

Java Local Development Environments Advanced Tooling Code Generation

Tara Edwards
Tara Edwards
6,521 Points

My version of IntelliJ does not have constructors as a code generation option

The only option I get when I get to the Generate menu is "Copyright". I have looked through JetBrains, but they do not say what to do if a constructor is not on the menu. I could make a constructor, but that would not be the point of the lesson.

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Tara;

Code generation is somewhat intelligent in that if your cursor is not in a place inside your whatever.java file in which a constructor would make sense, it won't prompt you to generate a constructor.

Ken

Tara Edwards
Tara Edwards
6,521 Points

My cursor was put inside the SongRequest.java file. It is 15.0.2 version. So, is there something that I should have added?

Ken Alger
Ken Alger
Treehouse Teacher

Where inside the file? Inside the class or just inside the file randomly? It makes a difference.

Tara Edwards
Tara Edwards
6,521 Points

I did not think that the constructor for the class should be within the class. So, the cursor was just outside of the class.

Tara Edwards
Tara Edwards
6,521 Points

OK, I watched the video and tried putting the cursor within the class. It showed constructor. So, I am OK now.

Ken Alger
Ken Alger
Treehouse Teacher

Pleased it worked out!

Happy coding,
Ken