Levels of locks in Java

Source: Internet
Author: User
Tags instance method
The locks in Java can be divided into object locks, Fang, and class locks by hierarchical points.


Java object locks and class Locks: Java's object locks and class locks are basically the same as the built-in locks in terms of lock concepts, but

Two locks are actually a big difference, object locks are used for object instance methods, or for an object instance, class

A lock is a static method for a class, or a class object on a type. We know that object instances of classes can have a very

multiple, but each class has only one class object, so object locks for different object instances are not interfering with each other, but

There is only one class lock per class. But one thing to note is that the class lock is actually just a conceptual thing, and

is not real, it's just to help us understand the difference between a locked instance method and a static method.

Levels of locks in Java

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.