"Gradually excavation of autoboxingauto-unboXING" errata (1)

zhaozj2021-02-16  150

The last one in the original "reference resource" should be:

A set of container classes that specifically to save basic types of data are available in Jakarta Commons Primitives components. And use Java Collection Framework and Autoboxing / Auto-Unboxing to complete the same task, they have more advantages over performance.

Thank you for your pointing.

Original "Listing 4: The equivalent form after autoboxing" is incorrect, should be:

Listing 4: Equivalent form after Autoboxing

Collection al = new arraylist ();

Al.Add (

Integer.Valueof (1));

When performing autoboxing, it is not a configuration method of the corresponding parcel class, but uses their Valueof static method to obtain a new instance (the Valueof method of the package classes in J2SE 1.5 is enhanced, and the corresponding basic type of value can be accepted. Parameters).

Corresponding, original "Listing 11: Autoboxing operations occur before the automatic upward transition" should be changed:

Listing 11: AutoBoxing operations occur before the automatic upward transition

INT I = 27828;

System.out.println (

(Long) INTEGER.VALUEOF (i)); / * Compile time error * /

In addition, the original "Listing 12: Need to force up to the top, then make Boxing" There is a pen error, should be renamed:

Listing 12: Need to force up to transition first, then make Boxing

INT I = 27828;

System.out.println ((long)

(long) i);

转载请注明原文地址:https://www.9cbs.com/read-8959.html

New Post(0)