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 Exploring the Java Collection Framework Sets

Imports == Alphabetical order?

I have just noticed that all imports seem to be in alphabetical order is this a must?

import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

3 Answers

Nope :-)

No it is not. The order is entirely up to you. The only must when it come to import statements is that they have to be placed at the top of the file, or directly below the package statement if there is one. Other than that you are free to place them as you wish.

Thanks guys, I was noticing in the tutorials that they seem like they are in alphabetical order and it got me curious -now I know better!