Common problems for beginners in Java [5]: lack of knowledge about JVM

Source: Internet
Author: User

Last Post
I have discussed several misuse of Java exception mechanisms. Today we will talk about topics related to JVM (and Java compiler. Why about JVM pinch? Because many Java programmers
Lack of knowledge about JVM makes it impossible to get started when encountering certain technical problems. In addition, the lack of knowledge about JVM may lead to huge performance or serious bugs in the written code. So in my previous post, "the trilogy of Learning Technology: What, how, why
", Emphasizing the importance of mastering internal mechanisms. For a Java programmer, you do not have to be very clear about JVM details, but you still need to master general concepts for some key operating mechanisms.

According to the practice in this series, I will ask a few JVM-related questions. If you are not very familiar with these questions, you should take some time to understand them. In addition, some netizens criticized "this series
Post: diagnose faults without prescribed prescriptions. (It is very vivid and pertinent) I will write some posts to answer the questions raised below.

Basic Types and reference types

Many new users do not understand the differences between the basic and reference types of Java. See the following questions:
◇ What are the differences between these two types of memory storage?
◇ What are the performance differences between these two types?
◇ What are the differences between the two types of GC?
For the first two questions, see the previous post "Java performance optimization [1]: basic type vs reference type
".

About garbage collection)

Many new users do not understand the implementation mechanism of GC. See the following questions:
◇ How does GC determine which objects have expired?
◇ What are the effects of GC on performance?
◇ How can I optimize GC performance through JVM parameters?
For GC problems, see the previous post "Java performance optimization [3]: Garbage Collection (GC)
".

About strings

For the string and stringbuilder provided by Java, many people must know that string is used for constant strings, and stringbuilder is used for variable strings. Why is Java designed like this? Why don't I need a class to solve the problem?

Generic programming)

From JDK 1.5, Java introduced a heavyweight Syntax: paradigm. However, many new users only know about the model, but do not know much about many essential things.
◇ GP is implemented during compilation or runtime? Why?
◇ What is the type erasure mechanism of GP? What are the advantages/disadvantages?
◇ What is the performance impact of using a fan-type container (relative to a traditional container? Why?

Multithreading

In addition, multithreading is also a shortcoming for most beginners of Java. So I will come up with a few more questions about multithreading.
◇ How does the synchronized keyword work?
◇ What is the granularity (or scope) of synchronized? Is it for a class or for a class object instance?
◇ Does synchronized affect the performance? Why?
◇ Volatile: what is the use of volatile keywords? When do I need to use this keyword?


Copyright Notice

All original articles in this blog are copyrighted by the author. This statement must be reprinted to keep this article complete, and the author's programming will be noted in the form of hyperlinks
And the original address of this article:

Http://program-think.blogspot.com/2009/05/defect-of-java-beginner-5-jvm.html

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.