Basic Commands

Comments

// line comment 

/* block comment
 * this is still part of the comment
 * third line of comment
/* 

/** Java-doc comment */  // used to auto generate documentation!

Example Code

// import packages
import javax.swing.JOptionPane;   // only «JOptionPane» 
import javax.swing.*;             // whole package «swing»

// class declaration
public class Test () {
    // main method (to make the program runnable)
    public static void main(String[] args) {  
        // print message to console
        System.out.println("Hello World!");
    }
}

Printing to Console

// console out
System.out.print(X);      // prints X (no newline)
System.out.println(X);    // prints X (with newline at end)
System.out.printf();      // more advanced console log method