jdk1.5 new features and jdk1.7 new features

Source: Internet
Author: User
Tags float double

jdk1.5 new Features

1. Automatic box packing and automatic unpacking

Automatic boxing, the value of the base type into an object type Integer a = 2;

Automatic unpacking, the object type is changed to the basic type int b = new Integer (2); You do not need to call Intvalue int b = new Integer (2). Intvalue ();

The wrapper class has an Integer Boolean Float Double Short Byte

2. Enumeration

Java enumerations are simple and secure.

3. Generics

Generics can control the type at compile time, such as list<string> list = new arraylist<string> (), List.add () can only add string types, add other types, the compiler will error, But the bottom doesn't control him.

Type input, by reflection or by adding other object types to the

4. Variable parameters

public void method (Type ... value) {

5. Static Import

Import static Org.fkjava.oa.base.Jia.jia, you can use a class

6. Introspection

Generally we get the private property of JavaBean, which is obtained through getter and setter methods, but jdk1.5 provides a set of APIs to get JavaBean properties without the need to invoke getter and setter methods. And we don't need to care

Specific internal implementations, but we still need to understand the specific implementation. To get BeanInfo information through class Introspector. In the beaninfo to get the property descriptor Proertorydescriptor, By calling Propertorydescriptor to get the properties of the class, we know that this is done through the reflection of Java.

jdk1.7 new Features

1. Switch Support string

2.<> generics support automatic type judging list<string> List = new arraylist<> ();

3. The number can be underlined int abc = 100_33_322;

4. Support binary int aa = 0b1001_1111;

jdk1.5 new features and jdk1.7 new features

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.