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