Let's understand System.out.println() easily by example.


Example:

package javaapplication;

/**
 *
 * @author Rathorji
 */
public class JavaApplication {

    /**
     * @param args the command line arguments
     */
    static String str = "Hello world!";

    public static void main(String[] args) {
        // lenth of the string
        System.out.println(str.length());

    }

}


output:

12

Explanation

  • As you know here is JavaApplication is a class.
  • str