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

How to import classes like console?

I kinda get the using import java.io.Console; but how would I apply the Console console = System.console() if I were, let's say, importing a math class in?

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Han;

Welcome to Treehouse!

You can import as many libraries as you need for your project, so something like...

imports.java
import java.lang.Math;
import java.io.Console;

... is perfectly normal if you need something from both libraries.

Does that answer your question?

Happy coding,
Ken

I get the using the important method but in order to use the console methods, don't we have to make a console object? I'm asking how would I create object for other classes?