22
33If you made it through the [ Getting Started section] ( ./getting_started/hello_world.md ) you've successfully run this program.
44
5+ ~ IF toplevel_anonymous_class
6+
7+ ``` java
8+ void main() {
9+ System . out. println(" Hello, World!" );
10+ }
11+ ```
12+
13+ ~ ELSE
14+
515``` java
616public class Main {
717 public static void main (String [] args ) {
@@ -10,11 +20,26 @@ public class Main {
1020}
1121```
1222
23+ ~ ENDIF
24+
1325This "prints" - not in the sense of a physical printer, but like "displays on the screen" -
1426the text ` "Hello, World!" ` .
1527
16- Its a tradition for this to be your first program in
17- any language. Unfortunately, for reasons that are impossible to explain with the context you have at this point,
28+ Its a tradition for this to be your first program in any language.
29+ ~ IF toplevel_anonymous_class
30+
31+ We aren't quite at the point where I can explain what ` void main() ` means, but
32+ all you need to know for now is that it is what Java looks for to know where to start the program.
33+
34+ ``` java
35+ void main() {
36+ < WRITE YOUR CODE HERE >
37+ }
38+ ```
39+
40+ ~ ELSE
41+
42+ Unfortunately, for reasons that are impossible to explain with the context you have at this point,
1843half of this probably reads as cryptic nonsense.
1944
2045``` java
@@ -33,6 +58,8 @@ public class Main {
3358}
3459```
3560
61+ ~ENDIF
62+
3663So for all intents and purposes, this is the whole program.
3764
3865```java
@@ -51,6 +78,20 @@ System.out.print("World");
5178System.out.println("!");
5279```
5380
81+ ~IF toplevel_anonymous_class
82+
83+ Which, when we add back `void main()`, looks like this.
84+
85+ ```java
86+ void main() {
87+ System.out.print("Hello, ");
88+ System.out.print("World");
89+ System.out.println("!");
90+ }
91+ ```
92+
93+ ~ELSE
94+
5495Which, when we add back the part you are squinting past, looks like this.
5596
5697```java
@@ -63,6 +104,8 @@ public class Main {
63104}
64105```
65106
107+ ~ENDIF
108+
66109You should get in the habit of, whenever you see some bit of code, trying to physically type it out, run it,
67110tweak it, and play with it.
68111
0 commit comments