J2SE entry notes 40

Source: Internet
Author: User

1. removed the function that can access elements through [] or using pointers in C/C ++ 2. arrays are similar to objects. They are all created using the new keyword. 3. the element type is determined during declaration. 4. you can use the collection class to store different types of array elements. the array declaration does not need to allocate any storage space. It only means to create an array. This is different from C/C ++. the length attribute can be used for the array length, which is different from the getsize method in C/C ++. 7. java does not have a statement similar to the redim preserve in VB that can change the array size. You can create an array of the same size and copy existing elements to it. java does not support multi-dimensional arrays, but supports arrays, namely nested arrays. The difference with C/C ++ is that Java arrays do not need to have the same length 9. the default value of the Java array is integer 0, and Boolean is false10. class-level variables have a default value, but the member variables in the method are not 11. keywords: public, fin Al, static, abstract, native, transient, synchronized, and volatile12. Java only allows single inheritance, but has a feature called interface 13. static cannot access a non-static variable and method 14. static Method rewriting is not only an alternative to methods, but also a reference-based class type problem for methods determined during runtime. It can also be understood as a static method that can be rewritten, but the static method of rewriting does not support polymorphism 15. the abstract modifier method does not have a method body and can only run when the subclass is executed. classes inherited from abstract classes need to implement the abstract method of the base class, or declare itself as abstract class 17. the final class cannot be inherited, and the methods in the final class automatically become final Method 18. the final modification method cannot be rewritten 19. except constructors, which have the same name as the class, it may be Method 20. constructors cannot be final, static, abstract, or nativ. E. synchronized21. Java cannot use non-zero to indicate true or zero to indicate false like C/C ++. It can only accept values of the boolean Type 22. the finally clause is not executed at any time. Before the finally clause is executed, System appears. exit (0); then exit 23. you can use System. gc () is recommended for the garbage collector to collect garbage, but this does not guarantee that 24. inaccessible objects can be recycled, that is, null or reference to this object points to other objects 29. internal class, external class, nested class and their access area 30. the default value of data with decimals is double instead of float. If you try to directly define float I = 1.0, an error is returned. the toString () method is used to determine the return value of the object type. For the toString method of the object variable, the memory address is simply returned. Therefore, the result of the = operation is the same as that of www.2cto. com32. the thread needs to implement the method run (), However, instead of calling this method to start, it is start () 34. cause of thread blocking:. the thread has been set to sleep for a certain length. B. after the suspend () method is called, it will remain blocked until the resume () method is called c. this thread is suspended because the wait () method is called. When the notify or yyall message is received, the thread is re-activated. 35. yield () 36. you can use the Thread in the Thread package. setPriority is used to set the Thread priority. You can use getPriority to obtain the Thread priority. The default priority is Thread. NORM_PRIORITY37. synchronized can be used to mark a piece of declaration or lock a piece of code. The lock here is based on objects rather than method-based 38. wait and policy should be placed in the Code marked by the Synchronized keyword to ensure that the current code is monitored by the monitor. methods In the Math class: abs, ceil, floor, max, min, random, round, sin, cos, tan, sqrt40. the signature of the hashCode method is public int hashCode ();

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.