FAQ: Hello World: Java - Hello Java File!

This community-built FAQ covers the “Hello Java File!” exercise from the lesson “Hello World: Java”.

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

Learn Java

FAQs on the exercise Hello Java File!

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

Ask or answer a question about this exercise by clicking reply (reply) below!

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

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

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!

learn about in future lessons. String args is a placeholder for information we want to pass into our program. This syntax is necessary for the program to run but more advanced than we need to explore at the moment

1 Like

This lesson is not explained well in the exercise instructions, specifically the lack of mentioning the semicolon after the close parenthesis of the print line. The semicolon to close out that line of code should be mentioned at the very least, if not highlighted for the beginner. It is very easily overlooked, and then if you click on “show me the correct answer” it simply replaces the code you wrote without showing you exactly what you did wrong.
The explanation of your name replacing “someName” in the instructions was also confusing to me. It gave me the impression that I was literally supposed to enter “someName” and then have another line of code that replaces “someName” with my own name.
The “Hint” section even further confused me by changing “Hello someName” from the instructions to “Howdy World!”… WTF?? Keep things simple, don’t keep changing things! This is the f*cking introduction for people who do not have the first clue about writing code or programming language!
Conclusion:
For a free trial section that’s supposed to entice people to spend their money on the rest of the program, it’s not going to convince many people that their money will be well-spent if they can’t even get through the introduction with a solid understanding of basic code structure.

11 Likes

Java is a very difficult first programming language, given its completely OOP, which means there a lots of concepts to grasp at once.

is this the first programming language you learn?

Yes it is rather difficult- that’s why I made the remarks I made. I feel the instructions need to be made more clear.
I have had an introduction to JavaScript, so I do have some basic understanding of programming language. This is the only reason that I realized I had left out my semicolon which I mentioned above; the tutorial did not guide me in this aspect to help me realize that I had forgotten to add a semicolon. I’m just saying there is room for improvement.

Step 2 won’t let me type. And I need help with it.

2 Likes

System.out.printIn(“Hello Diamond!”);

The code above is my own typed code. It was wrong.

JavaProblem%20%232

This code is a solution. But it’s System.out.printIn is different than mine. It has this different type of “I” when I typed the code. Yet, mine is wrong and the solution is correct. Is this some sort of bug or it’s intentional?

1 Like

Why do we use double quotes in system.out.println and what does it denotes?

double quotes are used for a string in Java

what is the function of the semicolon ( ; )?

The semicolon marks the end of a statement.

Yes I have to agree with many of the people above. This course is horribly explained. It is definitely not meant for beginners, otherwise it would explain much better than it does, because I got stuck on the 2nd part of the 1st course I even decided to try.

It would be really nice if I could get some help please… Still stuck on that same 2nd part and I have tried putting semicolon’s everywhere, all kinds of brackets, tried even typing it in different places and still doesn’t work. Where is everyone? I thought this was supposed to be an online academy where I can learn things and get help when I need it.

And where the ■■■■ is this ‘show me the correct answer’ button? I could probably see where I went wrong if I could see the correct answer, but there is no option to view the correct answer. So far I’m not very impressed here and I will probably find somewhere else that is much more useful, even if I do have to pay more. At least then I may learn something. If I don’t hear back from someone soon on this, then you just lost me as a paying customer.

Hello, @text1541353265. If you’ll post a link to the exercise you’re stuck on, and paste your code using the </> button. I’ll try to help you out.

capture

Press Enter to go to a blank line, click that icon, and you will see this:

capture_r

Is this where you are having the problem?

The text editor has a file, HelloYou.java , that contains a HelloYou class with a main() method.

Inside main() , add a statement which prints Hello someName! , with your name replacing someName .

For example, if your name were “Maria,” the program would print Hello Maria! .

Thank you Midlinder! I appreciate your response very much. I apologize for the delay in responding to you; I am finally home from work. This is the code I have written down. I have followed the instructions exactly, or at least what instructions there are. Apparently I am missing something, I would love and appreciate the help.

`public class HelloYou {
public static void main(String[Hello Mitch!] args); {
System.out.println(“Hello Mitch!”);

}
}`

I have read and re-read the text many times, but there is no instructions on where to even begin typing the code. I mean do I have to erase what is already typed on there and completely start with all of my own code? Or is there a particular spot where the code needs to be entered? There is no explanation of any kind that I have been able to find. Once again, I really appreciate the response and help. I was pretty discouraged earlier, but I am regaining my confidence in this course.

I understand this can be quite confusing at first. Java is a pretty big challenge if it is your first programming language. In this exercise, your code will go inside the ‘main()’ method. When we refer to the ‘inside’ of a method, we are referring to the curly braces that immediately follow the method declaration. For example:

public class HelloYou { //this is the opening curly brace for the class: HelloYou
  public static void main(String[] args) { //this is the opening curly brace for main()
  //Your code for the exercise goes here
  //everything between the opening { and closing } is inside the method
  } //this is the closing curly brace for main()
} //this is the closing curly brace for HelloYou

In this line which is the method declaration:

you made a few changes that will need to be changed back. You can click the ‘reset’ at the bottom of the screen where you typed your code that looks like this:
image
to reset the exercise, or you can change it manually to look like this:

public static void main(String[] args) {

There should be no semicolons on this line, and there shouldn’t be anything between the [ ]'s. Once you get the main() method declaration fixed, this line from your code should work as expected: System.out.println(“Hello Mitch!”);. Make sure you keep the semicolon at the end. That should be the only semicolon in the code editor when you’re finished.

let me know if this helps, or if you need additional assistance. Just FYI, Java, as I stated earlier, is not the easiest language. I’ve noticed that there aren’t a lot of fellow forum members who chime in to help with questions in Java. I myself am not by any stretch an expert in Java. I know C# pretty well, and Java is quite similar, so I am able to be of some assistance. I am happy to help when/if I can. Good luck && happy coding!