Java overview

Introduction to the Java language

The Father of Java: James Gosling

 

Three versions of the Java language:

JavaSE: Standard version of the Java language, used for desktop application development and based on the other two versions

JavaME: (small version) of the Java language for embedded consumer electronic devices (now deprecated)

JavaEE: Enterprise version of the Java language for Web-oriented Web development


Cross-platform principles of the Java language

Instead of running Java programs directly, Java compilers compile Java source programs into platform-independent bytecode files (class files), which are then virtualized by Java

The JVM interprets the execution of bytecode files. Therefore, in different operating systems, you only need to install different Java VIRTUAL machines to implement Java programs

Cross-platform.


JRE and JDK and JVM

Java Virtual Machine (JVM) : Indicates a Java Virtual Machine

Java Runtime Environment (JRE), a Java Runtime Environment, contains the JVM and Java core libraries (Java APIS).

The Java Development Kit (JDK) is called the Java Development tool, which contains the JRE and Development tools

Summary: We just need to install the JDK, which contains the Java runtime environment and virtual machine.


This section describes the JDK installation directory


Common DOS commands

1. Open the command line window: win + r open the running window, enter CMD, and press Enter.

2. Common commands and their functions

 


Configuration of the Path environment variable

To develop Java programs, you need to use development tools (such as javac.exe and java.exe) provided by the JDK. These tools are in the bin directory of the JDK installation directory. It is not possible to put all Java files in the BIN directory of the JDK, so the purpose of configuring environment variables is to make java-related commands in the bin directory available in any directory.


Java program development runs the process

Write programs, compile programs, run programs

 


The HelloWorld case

write

1. Create a text file and rename it helloWorld.java.

2. Open the HelloWorld. Java file with Notepad and type the program content.

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

Compile and run

Save the file, open the command line window, switch the directory to the directory where the Java file resides, compile the Java file to generate the class file, and run the class file.

Compile: javac file name. Java

Example: javac helloworld.java

Execute: Java class name

Example: Java HelloWorld

Break down

Q&A

1. Illegal characters. Symbols in Java are in English format.

2. Case. The Java language is case sensitive (case sensitive).

3. Display the extension of the file in the system to avoid the appearance of helloworld.java.txt file.

4. The Java file name after the command is compiled must contain the file suffix. Java

5. The class file name (class name) after the command is executed does not contain file suffixes