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 Efficiency! Menu UI

Daniel Babbev
Daniel Babbev
10,354 Points

Message to Craig Dennis

Hello Craig, Instead of typing every time

System.out.print("Some text"); 

why don't we import System.out library and our code will be much shorter

import static java.lang.System.out;
//main method here
out.print("Some text");

just a better, handy way. Cheers :)

1 Answer

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hi Daniel!

Static imports, when used correctly, lead to more concise code. I think in this case it makes sense, but I haven't had the right time yet to teach about them. And even more to teach about when to not use them.

There are folks who are very against static imports or at least say to use them sparingly. I plan to go over them when we cover jUnit which encourages their use.

Thanks for bringing it up!