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

Basic flow of Java program execution

藏色散人
Release: 2019-11-19 14:54:39
forward
3060 people have browsed it

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!");
  }
  }
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template