synchronized/java.util.concurrent.locks.loc/How to format the date/convert the character "12345" to a long type

Source: Internet
Author: User
Tags date now
1, briefly describe the similarities and differences between synchronized and Java.util.concurrent.locks.Lock?
Answer:
Main similarities: Lock is able to accomplish the main differences in all the functions implemented by synchronized: Lock has more precise line semantics and better performance than synchronized. The synchronized automatically releases the lock, and lock must require the programmer to release it manually, and must be released in the finally clause.

2. How to format the date
Answer:
Date Now=new date ();
SimpleDateFormat sdf=new SimpleDateFormat ("Yyyy-mm-dd hh:mm:ss");
String Formatnow=sdf.format (now);
Variable Formatnow is a well-formed date.

3. Convert character "12345" to long type
Solution: String s= "12345";
Long num=long.valueof (s). Longvalue ();

synchronized/java.util.concurrent.locks.loc/How to format the date/convert the character "12345" to a long type

Related Article

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.