Java learning and java

Source: Internet
Author: User

Java learning and java
0. above

I used to learn C/CPP before. For some reason, I plan to repeat the basics of Java from the beginning to consolidate it. As a result, I started to learn Java from today. I will write some of my experiences during the Java review process to help me sort out my knowledge.

1. synchronized

The synchronized keyword has never been seen before, so I Googled it. It locks objects, methods, and code blocks so that only one thread can be executed and used at the same time. It is equivalent to a mutex.

Ii. transient

After a class implements the Serializable interface, some of the data does not want to be serialized, such as the password, you can use transient for marking. The marked attributes are not written during serialization. Of course, it is null when reading.

Iii. volatile

It is used to identify a variable as a shared variable. When it is marked by volatile, different threads always get the same value when using this variable. However, volatile is not atomic.

Iv. strictfp

Exact floating point. When a method is declared using strictfp, the float and double expressions in this method strictly abide by the restrictions of FP-Strict. It can be used to avoid floating point calculation errors caused by different hardware, or when more precise values are needed.

V. instanceof

Used to determine whether an instance is an instance of a certain class (or its subclass.

 

========================================================== ==========

I haven't written a blog for a long time, and I feel like I can't write anything. However, it will work harder.

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.