Home  >  Article  >  Java  >  Basic flow of Java program execution

Basic flow of Java program execution

藏色散人
藏色散人forward
2019-11-19 14:54:023025browse

The following tutorial column from java learning will introduce you to the basic process of Java program execution. I hope it will be helpful to friends in need!

Let us take a look at the Java program execution process:

For example, hellojava.java file, the code is as follows:

  public class hellojava
  {
  public static void main(String[] args)
  {
  System.out.println("hello java!");
  }
  }

Compile in the current directory: javac hellojava.java

Run in the current directory: java hellojava

Output: hello java!

Explanation: Compilation is to compile files, and the file name hellojava.java must be written; running is to classes, so only Just write the class name.

Description: The java executable file will search for the hellojava class in the files in the corresponding directory according to the environment variable CLASSPATH. CLASSPATH contains the current directory, so the program can find the current directory. hellojava class in hellojava.class file)

The above is the detailed content of Basic flow of Java program execution. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete