FAQ: Hello World - Print Statements

This community-built FAQ covers the “Print Statements” exercise from the lesson “Hello World”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Build Basic Android Apps with Java

Learn Java

FAQs on the exercise Print Statements

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in Language Help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.

Looking for motivation to keep learning? Join our wider discussions in Community

Learn more about how to use this guide.

Found a bug? Report it online, or post in Bug Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Why does the “One…” statement still end up on the same line as the “Three… Two…” statement when, I used the System.out.println syntax for it???

I was expecting the Sytem.out.println to create and new line for the statement…

1 Like

I was expecting it “One…” to print on another line as well but I realized why it printed on “Three… Two…” instead. The reason for that was because “Three… Two…” was never given the command to print on two separate lines so whatever is printed after that will be included in the “Three… Two…” output as a complete line. Capture

It looks like it is not working in that way. Even when I use println it is still remaining in the same line rather than moving to the next one. Ideally as per the theoretical concept when the print is used it will remain on the same line but when the println is used it should move to the next line.

1 Like

For anyone who’s still confused about the println function, it adds a new line after the (output);

And only after the output.

Something that isn’t mentioned (that I could find), but is VERY important, is that commands in this language are case sensitive. As an example: system.out.print(“”) will result in a compiling error vs. System.out.print(“”) will not. Mentioning this prior to the exercises might result in fewer errors by students who currently have to make that realization for themselves.

1 Like

i understand this statment .because your explanation is very good .

I’m currently stuck on the part where it says System.out.print(“Two…”); It keeps asking me if I’ve used the correct format and I believe I did and now I’m stuck after reloading the page, looking at the hint and trying to look here

At the bottom of the exercise, there is a “Copy to Clipboard” button. Click on it to copy all of your code.

To paste your code in the forum with correct formatting, you can use the </> button (See [How to] Format code in posts for details).

That should hopefully offer some clues as to why your code is not being accepted.

public class HideAndSeek {
public static void main(String args) {
System.out.println(“Let’s play hide and seek.”);
System.out.print(“Three”);
System.out.print(“Two”);
}
}

Keep getting an error, keeps asking me if I used the Print line function for some reason… why?

When you copy-paste code directly into the forums, some characters lose their formatting which makes it difficult to spot any potential issues. To preserve code formatting in forum posts, see: [How to] Format code in posts

Your strings should match the strings specified in the instructions EXACTLY including capitalization, spelling, spacing etc.

// You wrote:
System.out.print("Three");
System.out.print("Two");

// It should be:
System.out.print("Three...");
System.out.print("Two...");

public class HideAndSeek {
public static void main(String args) {
System.out.println(“Let’s play hide and seek.”);
System.out.print(“Three…”);
System.out.print(“Two…”);
System.out.println(“One…”);
System.out.println(“Ready or not,here I come!”);

}
}
I have just finished this exercise but am not allowed to move to the next stage. Why? Is there any problem with the code

To preserve code formatting in forum posts, see: [How to] Format code in posts

// You wrote:
System.out.println("Ready or not,here I come!");

// It should be:
System.out.println("Ready or not, here I come!");

this website its a waist of time i wrote manually like 20 times and doesnt work, i will never buy the paid version
System.out.print(“Three…”);
System.out.print(“Two…”);

There are two things that can offer clues as to why your solution is not being accepted. You can either

  • Upload a screenshot showing ALL your code and the error message/feedback which pops up at bottom (There is an upload button in the forum post editor).

OR

  • There is a “Copy to Clipboard” button at the bottom of the exercise. Click on it to copy your code. Don’t paste the code directly into the forums, because doing so messes with the formatting of characters etc. Instead, use the the </> button to paste your code (For more details, see: How do I format code in my posts?)