Java Hello world


Usually in order to help beginners quickly entry, a variety of programming languages ​​have a very simple HelloWorld procedures, so that beginners quickly understand the most basic features of a program. The following is HelloWorld Java version.

/*
 * Define a class file and display "Hello, World!" On the screen.
 */
public class HelloWorld {
    public static void main( String[] args ) {
        System.out.println( "Hello, World!" );
    }
}
/* The end of this class file.  */

First of all, this procedure is a class, class name is HelloWorld. The Java convention class name is the same as the file name, so the saved file is named HelloWorld.java. A HelloWorld.class file is generated after successful compilation.

Program from the main function to start the implementation, it should be noted that it is a static method, method name in front of static modification. On the static members and the essence will be mentioned later, here only need to know it is a static method can be.

System is a class that represents the Java runtime system; out is a member of the System that represents the standard output of the system; the println() method is an abbreviation for print line, indicating that a line is printed.




Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook