Java entry (1)-Java program running mechanism and process

Source: Internet
Author: User

Java has been around for almost two weeks. The overall impression of Java is flexibility, efficiency, and security. but at the same time, I also feel a lot of shortcomings. since we have been in contact with each other before. net. let your own ideas be very fixed. Net good encapsulation so that a lot of work is done by machines for me. it also limits many features.

I have been working on MIS, which has greatly reduced my underlying programming capability. sometimes I really feel like I am not programming. I will take advantage of this opportunity to learn Java and supplement the language and syntax.

 

Java has two core mechanisms: Java Virtual Machine (javavirtual machine): Garbage Collection)

These two mechanisms support the running of Java programs.

Java Virtual Machine (JVM)

Java Virtual Machine (JVM) is a specification used for computer devices and can be implemented in different ways (software or hardware. The Instruction Set for compiling a virtual machine is very similar to the instruction set for compiling a microprocessor. Java Virtual Machine includes a set of bytecode instruction sets, a set of registers, a stack, a garbage collection heap, and a storage method domain.

Since JVM is a virtual machine, it is similar to a computer. It has its own CPU, memory, and so on. Of course these are all simulated by software.

Because of the existence of this virtual machine, Java code can be compiled and exported for running at a time. This virtual machine shields the differences between underlying operating systems. Of course, different virtual machines corresponding to different operating systems.

The Java application execution process is like this:

 

Java source code is compiled into. Class Code by using the javac command.

Then, the. Class Code is interpreted and executed in JVM. The JAVA source code here only needs to be compiled once. Its. class code can be run in any place containing JVM.

 

Garbagecollection)

Java garbage collector is used to recycle memory space that is no longer used after the program runs. what I understand here is mainly to recycle the memory in the heap. it is mainly the new object of the program. when you do not need it, you will be responsible for recycling it after a certain period of time. these are automatically executed when the program is running, without the intervention of programmers. this will also save programmers a lot of trouble.

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.