Java Learning Note 1

Source: Internet
Author: User

, high-level language operating mechanism

High-level language according to the implementation of the program is divided into two types of compilation and interpretation .

The Java language is special, and the execution of a Java program must be preceded by a compilation of the steps explained.

1 compile to generate bytecode, perform interpretation only for JVM (. Class) 2JVM

The JVM:(Java Virtual Machine) is responsible for interpreting the execution bytecode files and is a critical part of the Java program's cross-platform.

Cross-platform principle: The JVM of all platforms provides the interface of the Java byte code up to the same-+, the interface to adapt to different platforms is not the same.

Tip: Windows operating systems (case-insensitive) find commands through the PATH environment variable, the Linux operating system (case-sensitive) finds a command through the PATH environment variable, and the value of the environment variable is a series of paths.

After you add an environment variable, you can run related commands in the Command window.

Compiling Java programs Javac srcfile

Run Java program Java Java class name

Basic Java Program Rules

A Java program is a purely object-oriented programming language that must exist in the form ofclasses (Class), which is the smallest program unit of a Java program. All program parts must be placed in the class definition.

The Main method is the entry for the Java program, and the Java Virtual machine interprets the execution from the main method. Public static void Main (string[] args)

In a large Java program, only one class contains the main method, and the other classes are called directly or indirectly by the main method.

Naming rules for Java source files

The primary file name of the Java source file must be the same as the class name of the public class, and a maximum of one public class can be defined in the Java source file.

garbage collection mechanism (garbage collection)

Memory leaks: The allocated memory is not recovered in time, causing the system to run down.

The JRE provides a background thread for detection control, which is automatically garbage collected when the CPU is idle or low on memory.

When no reference variable points to the memory that was originally assigned to an object, the JVM's super thread automatically frees the memory.

(See also "Java Virtual machine" For more detailed mechanisms)

Java Learning Note 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.