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 Basics Getting Started with Java Strings and Variables

Console Console?

Why use console console?

I am not an absolute beginner and In my opinion its easier to learn from a scratch workspace, but why are you using console?

Public class HelloWorld {

public static void main (String[] args) {

System.out.println("Hello world,");
System.out.println("This is nothing special.");

}

return 0;

}

Would perform the same task.

/* Edit

or in my case I would run it as one line.

System.out.println("Hello world, This is nothing special\n");

3 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

We are going to be building a console application. Console is the proper abstraction, and I didn't want to get into using too many objects before introducing them. Stick with it, I use System.out.println in the next course.

Trying to avoid the cognitive overload, which happens to just about everyone who attempts to learn this overly verbose language. ;)

That make sense?

Andrew McCormick
Andrew McCormick
17,730 Points

It would seem they chose this way because he wants to illustrate working with multiple lines . In the Video he puts a new line character after Hello World line in your example to show creating a new line, where as your example would put both messages in one line, then return to next line.

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Why downvoting Andrews answer?

Upvoted :smiley:

I see, that still isnt answering my question, I am asking is why are they running off of console?

wouldnt

public class FirstProject {

public static void main (String[] args) {

have the same affect?