JDK1.5 Usage Summary--"Java 1.5 tiger:a Developers Notebook"

Source: Internet
Author: User
Tags final new features string tostring
JDK1.5.1 out, is a perfunctory version of the Debug. The most important revolution in feeling JDK1.5 is annotations, while the rest, such as generics and concurrency and JVM tools, may be important weapons for some opensource, but they have little sense for the stars like us. And the rest of it is minor changes. Read it again. 〈java 1.5 tiger:a Developer's notebook〉, combined with previous applications, summarizes useful new features as follows: 0.Annotations the most important function, is believed to be together with the AOP, breaks the traditional C + + barriers The language revolutionary weapon. In contrast, dynamic languages simply simplify the amount of code and do not break through the programming architecture. 1.AutoBoxing This is the only JDK1.5 to let the small citizens have the feeling of the new features, and finally no longer the integer and int between the explicit conversion, but this is the natural thing. 2.Generics feels like a strong type lock for all container classes, and in a world where dynamic languages like Python are in the way, strong typing seems less popular. The generics benefit is type safe and does not have to be type-converted at the time of the loop. The downside is that all definitions and declarations are added to the type definition, making the total code volume increase. If you use the old-style looping syntax, even iterator must declare the type. Alternatively, you can try writing your own generic class, which may be helpful for some open Source util classes, but your own business class will only be considered for use if OO cannot be resolved. such as public class Box {private List contents;} 3. The for/in statement replaced Interator. But in addition to several basic types, you must use the generic Declaration collection. 4. Enumeration enumerations can replace the previously bulk public static final a=1; public static final b=2; More can replace the more irregular direct use of string "A", "B" and int 1,2 to replace the benefits of the 2nd case goes without saying. STATIFC final a=1 because still can't limit programmer lazy to use int directly, so lose with enum. And the enum has less code, and can do other extensions. 1.Base public enum Grade {a,b,c}; Grade.a.tostring () = "A"; Grade.valueof ("A") returns GradE.A; The ToString () method can be overloaded, but it needs to overload the ValueOf () Method 2. Typically, enumerations are inline defined and rarely own a single class file public class Downloader {public static enum downloadstatus {initializing, in_progress, COMPLETE}; 3. Traversal grade[] gradevalues = Grade.values (); For (Grade g:grade.values ()) {out.pring (g);} 4.EnumMap ()/enumset () antmessages.put (Antstatus.error, "ERROR occurred."); 5. The complexity of the expansion has not yet been carefully 5. Static imports simplify the use of the tool class, such as Strutil.isempty () can be written as IsEmpty (), and can only import the specified functions can also be statically imported enum, For example, STATUS.A can be written as a, but also caused by the ambiguity of reading. 6. Other features better Unicode support, and JDBC RowSet. 7. The features that are useful to me end Threading, JVM tools and swing (hopefully AROGUML will look better with a new metal ocean style), queue, and network and Secuirty minor improvements not available on the occasion, C Style formater do not want to use, and variable parameters in fact, in JDK1.4 can be passed in when it is done with a list, rather than in a string ..., to the function of the string ... Back to list more specific JDK1.5 updates, http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html J2SE 1.5 In a nutshell Chinese version http:// Dev.csdn.net/develop/article/24/24440.shtm

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.