Beginning Steps
Last updated
Last updated
Take a look through your App.java class. Yeah— it's only around 5 lines of code. But we'll fix this. All of your code is put into classes. Classes are like the blueprints of your code— they define your code's purpose. We'll go into more detail much later.
Most programming languages require a starting point for their code when it's run. For Java, it's the main method. If you look at your App.java file, the main method is the only thing inside your App class.
If you look at the main method, you might notice the Run | Debug
stuff above it. If you want to run your code, click this. You could also click the arrow next to the Command Palette to run it. Click the "Run" button below and see what happens.
Well— nothing happens. Except that a cool window appears on the bottom of your screen (obviously, since there's no code yet). Sorry about that. Let's fix this by writing our first line of code!
Print statements log a single line into the terminal— that cool window that just opened. They're primarily used for debugging, which is using strategies to fix errors in your code.
There are two types of print statements:
All this does is print whatever's in its parameters (data in the parenthesis) into the terminal, and nothing else.
This is similar to System.out.print() except that after the text is printed, the pointer goes down a line. It's like writing a sentence then going down a line.
Throughout this entire GitBook you'll encounter tons of different challenges such as this one. All the requirements are given below, plus hints if needed. Since this "challenge" is more of a rite of passage, I won't be giving the solution or any hints.
All you'll need to do is:
If you wrote it down in your print statement and ran your code, "Hello World!" should appear in your terminal. If it does— great job! You just completed the coders' rite of passage.