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

xi chen
xi chen
41 Points

Symbols

Hi, with zero programming knowledge I was getting more and more confused watching this video, especially with those symbols "" ; \n etc.. I feel like I've missed some fundamental stuff. Is there any more basic courses I should've watched before this java basics? Thanks!

2 Answers

I believe that the java basics course is the first course for java on treehouse. I see you're on Strings and variables. Do you have any specific questions about some of the symbols and special characters you've used thus far?

In an attempt to answer your broad question, just remember, String literal values must be placed inside of " ". Any variable you declare in java will end in an ;. And \n is referred to as a String modifier, there are quite a few of them, but what the \n modifier does, is it creates a new line, wherever you place it inside of your print statement.

String helloWorld = "Hello World";  //helloWorld is the variable name, it's of type String, and the assigned value is "Hello World".  And since it's a variable it ends in a semi-colon.

System.out.println("Hello \n World");  //If I didn't use \n, The output would be "Hello World" on one line, instead of two.

OUTPUT FOR PRINTLN STATEMENT

Hello
World

I hope this clears some stuff up for you, let me know if you still have questions.

Don't get discouraged if you come across some material or code that you don't understand right away. The best way to fully understand these concepts is to practice with them, and see if you can use them in a simple way.

Vincent Murray
Vincent Murray
11,300 Points

Go to YouTube search for THE NEW BOSTON - Bucky Roberts . Search in his playlist for Java beginner

https://www.youtube.com/channel/UCJbPGzawDH1njbqV-D5HqKw