Methods?

You may have noticed that I called Java's main function a main method. A method is simply a function that's inside a class. Java requires all functions to be inside classes, so all Java functions are referred to as methods.

It's good to get used to the vocabularly Java programmers use because it will make it easier to search for help later on. Make an effort to adopt the terminology.

Exercises

Each section will have exercises at the end of it. It's very important to actually do them. You can't learn a programming language just by reading code; you have to actually write it.

These exercises will help you see some of the other ways Java is different from Python. Remember to recompile with javac every time you make a change to your code.

Move the print statement outside of the PrintHelloWorld class, like this:

Rename the main method to something else. Does your program still compile? Change the name back to main but remove some of the keywords from the main method declaration (like public or static). Try compiling/running your program.

Change the name of the class to printhelloworld, all lowercase. What happens when you compile or run?

Add another print statement that prints out your first and last name like this: System.out.println("FirstName" + " LastName"). Can you use a comma to separate strings like you would in Python: print("FirstName", "LastName")?