(String args): This method takes a String argument. static: This method can be run without having to create an instance of the class HelloWorld. void: This method does not return anything. Let's break it down: public: This method is public and therefore available to anyone. It also is defined within curly braces (on line //3 and line //5).
Note the lines with " //" above. These are comments in Java, and the compiler ignores them. Just remember that your program code must match the example code, and you’ll be fine.
It will help you learn Java more quickly because you will get a feel for how programs are written, and best of all, you will make mistakes! This may sound odd, but each mistake you make helps you to become a better programmer in the long run. While you could cut and paste the above code into your text editor, it’s better to get into the habit of typing it in. For your first program, open up the simplest text editor you have on your computer, likely Notepad. Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.Īll Java programs are written in plain text - therefore you don't need any special software.