Monday, June 6, 2011

Hello World

Michael-Buens-MacBook:src Michael$ mkdir -p a/nice/humble

Note above, if you are in Windows, create each directory(i.e. a, nice, humble) one by one.

Then create the file:

Michael-Buens-MacBook:src Michael$ vim a/nice/humble/Person.java

If you are in Windows, use Notepad++, it's an awesome editor.

Then type this:
package a.nice.humble;

public class Person {

        public static void main(String[] args) {
                System.out.println("Hello World!");
        }
}

Then type this in commandline:
Michael-Buens-MacBook:src Michael$ javac a/nice/humble/Person.java

Then type this in commandline to run your first program:
Michael-Buens-MacBook:src Michael$ java a.nice.humble.Person

Note, need to use dots, not forward-slash nor backward-slash

Output:
Hello World!

No comments:

Post a Comment