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 Java Data Structures - Retired Getting There Class Review

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

java imports first?

around 9:17 he says we're supposed to put the java imports first, but in the other file it's the other way around. Also in the challenge following this video I got an error when I tried to put the java import first.

"Bummer! Make sure you keep the package statement on the first line. "

1 Answer

packages are always before imports :) Most IDE like Eclipse and Netbeans will create the package automatically at the top of your code and the imports right under it.

When there is no package needed, of course the imports are first. Sometimes you just want to import a package while the file should not be part of the package. The order of imports is not relevant