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 trialdisheng wang
5,422 PointsAbout Java Class
Hi, May I ask whenever I create a Java Class can I put a semicolon after the curly bracket? for example:
class House { // code in here };
This compiles successfully in the terminal, but does it consider a bad practice? My first language is C++. Thanks so much.
1 Answer
michaelcodes
5,604 PointsAdding a semicolon at the end of class declarations has no effect on the code. It is merely a syntax choice. If you feel more comfortable using it to keep consistency between C++ and Java go ahead. I think its adoption was to have a familiar feel for C++ programmers.