Hello to you!

In the previous tutorial, you may have noticed that it didn't really do anything useful. Yes, saying hello to the world might be good, but the main use of a program is for input/output. In other words have you input something, the program do something to it, and output it. Normally, the input would be a keyboard or mouse, and output would be like your screen. Ya know, your screen… It's what is allowing you to view this page. Because I typed it, now you can see it. If I where to put something like two ** before and after a word, it would look like this. This is because when I typed it in, I typed it in like **this**. The wikidot site saw this and said, I better make that bold. Hence, I inputed **this**, it processed it and output this. Now, on to some code.

public class Hello {
     public static void main(string[] args) {
          System.out.print("Hello ");

One new thing that you'll see is that there is a print() instead of println(). The only difference is that println() goes down one line after it prints the text specified (it prints the newline character \n). In this case, it prints "Hello " then whatever you specified after you called the program. The println("!") part of it prints the exclamation mark on the line and then enters down.

Another thing you'll see is the args[0] part. Well, to understand that, you have to understand variables. On to the next lesson.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License