Java Tutorial


java.jpg

Java is a high-level programming language launched by Sun Microsystems in May 1995.

Java can run on multiple platforms, such as Windows, Mac OS, and other UNIX versions of systems.

This tutorial will let everyone better understand the JAVA programming language through simple examples.

Java Online Tools

JDK 1.6 Online Chinese Manual


My first JAVA Program

Below we use a simple example to demonstrate Java programming, create the file HelloWorld.java (the file name must be consistent with the class name), the code is as follows:

Example

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

Run instance»

Click the "Run instance" button to view the online instance

Run the above instance, The output is as follows:

$ javac HelloWorld.java
$ java HelloWorld
Hello World

Execution command analysis:

Above we used two commands javac and java.

javac command is used to compile java source files into class bytecode files, such as: javac HelloWorld.java.

After running the javac command, if the compilation is successful without errors, a HelloWorld.class file will appear.

java command can run class bytecode files, such as: java HelloWorld.

Note: Do not add .class after the java command.

Gif picture demonstration:

java-HelloWorld.gif

Start learning JAVA programming

  • Start learning Java course

  • Java Object Oriented Course

  • Java Advanced Course