With each of these changes, you get error messages. Java is
case-sensitive. In this example, the correct words are public
, main, and System.
Stolen Semicolon
With the missing semicolon, you see a red error marker in your
IDE's editor. Java can't compile this code.
In many cases, with extra semicolons, the code runs correctly.
The additional semicolon is considered to end an empty statement
(a statement with no code).
With the indentation and line breaks changed, the code runs
correctly. Java doesn't care about indentation or line breaks
unless it's in the middle of a quoted string of characters.
When you change println
to print1n, you get
an error message. Java doesn't know what print1n means.
Java displays the text Use a straight quote ", not a curly quote ” which ends with a curly
quotation mark. In Java, \" represents a straight
quotation mark to be displayed on the screen, and \u201D
represents a curly quotation mark to be displayed on the screen.