Java Detail notes (September 16)

Source: Internet
Author: User

1, generics are just Java syntax sugar, it does not affect the Java Virtual machine generated assembly code, in the compilation phase, the virtual machine will be the generic type erase, to revert to no generic code, at most compile speed slightly slower, execution speed is completely no difference.

2, realize the conversion of GBK encoded byte stream to the UTF-8 encoded word stream:

The procedure is to decode and re-encode the string using the new string (SRC, "GBK") to decode the strings with GetBytes ("UTF-8") to get the UTF8 encoded byte array 3, correctly calculate the cosine of 42 degrees (angle)
Double D=math.cos (Math.toradians (42))
Because the units of the parameters in the Math.Cos are radians and your 42 is the angle, it is first to turn 42 into radians, Math.toradians is to turn the angle into radians.
4, overload only requires the parameter list is different, the return value is independent. 5, the use of the full name of the class. So do not need to use import 6, forward, the server to get jump page content to the user, the user address bar Redirect, is the server to send users to the address of the change, redirect after the address bar into a new address 7, The GetClass function of object is to return the run-time
Package name + class name
8, load Drive Method 1. Class.forName ("Com.microsoft.sqlserver.jdbc.SQLServerDriver"); 2. Drivermanager.registerdriver (New Com.mysql.jdbc.Driver ()); 3.system.setproperty ("Jdbc.drivers", " Com.mysql.jdbc.Driver "); 9, the Yte type value size is -128~127 between 10, the run () method is used to execute the thread body in the specific content of the start () method used to start the thread object, put it into a ready state the sleep () method is used to put the thread into sleep state suspend () method is used to hang the thread, To restart it by means of the resume () method 11, the JVM heap is divided into: Cenozoic (typically an Eden area, two survivor areas), the old age. The constant pool belongs to PermGen (method area) 12, 1, every time the constructor method is called, the construction block 2 is executed once, the static block is loaded only once when the class is loaded 3, when there are multiple static variables or blocks, loading 13 in the declaration order, first: The Member method is also called the instance method static method is also called class method second There is no this pointer C in the static method, you can call Class::fun ();d by the class masterpiece by the domain, too absolute, in the class to request a class object or parameter passed an object or pointer can be called; 14. Common Hash conflict Resolution: 1. Open address Law 2. Chain Address Method (Zipper method) 3. Re-hash 4. Create a public overflow zone 15,
The differences between sleep and wait are:  1, the two methods come from different classes are thread and Object  2, the most important is that the sleep method does not release the lock, and the wait method frees the lock so that the sensitive word thread can use the synchronization control block or method.  3,wait,notify and Notifyall can only be used in synchronous control methods or synchronization control blocks, and sleep can be    used anywhere   synchronized (x) {      x.notify ()     or wait ()   }   4,sleep must catch exceptions, while wait,notify and notifyall do not need to catch exceptions
16, enumeration class has three instances, so call three construction method

Java Detail notes (September 16)

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.