JAVA development: the development of your own first Java program

01_ Development of a Java program belongs to you

Java programs run principle

Java program goal is to compile once run everywhere, how did he do it?

We illustrated by the diagram:

16948984-45c690992ca2108a

By compiling we write java files into class files, and then run on the JVM class files, to complete the implementation of java files. That middle of this compilation and execution needs to have the support of a thing, is JDK. So, we need the official website to download the installation package. Note that different operating systems, JDK version is different.

JDK installation environment

After Jdk installation package download, here we demonstrate the process on windows installation:

16948984-0930b5ddcce51d4e
16948984-359a3fe95b820e9a
16948984-41ebe38280beec2d
16948984-f479091f570e3350
16948984-3cf53c2094933045
16948984-60f86ba5c2799441

Configuration environment variable

After installing the JDK, the relevant instructions not to do can be executed at any place, at this time, we need to configure the environment variable to achieve. See related operations shown below:

16948984-ece2c64c451b54b5
16948984-1cd52465f1adeead
16948984-bcf6377d7822be34
16948984-495eb0080ce302a5
16948984-faae6bf67f837f9b

Note that after you configure the environment variables, to re-open the command line window, re-read the new configuration for the job.

Written our first java program

Create a file, named Hello.java

Contents of the file are as follows:

public class Hi{

// execution entry

public static void main(String[] args){

// write command you want to execute

// output a greeting on the screen

System.out.println("Hello,Java!");

}

}

We run a Java program

16948984-eb4addc33e5ab1b1

Programming is a practice discipline, and quickly hands it!

Reproduced in: https: //www.jianshu.com/p/c7eb90cfcdb7

Guess you like

Origin blog.csdn.net/weixin_34261739/article/details/91064682