// line comment
/* block comment
* this is still part of the comment
* third line of comment
/*
/** Java-doc comment */ // used to auto generate documentation!
// 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!");
}
}
// 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