TAILIEUCHUNG - Language Features of Java Generics

ava™'s growth over the last five years has been nothing short of phenomenal. Given Java's rapid rise to prominence and the general interest in networking, it's a little surprising that network programming in Java. | Java Pro - Language Features of Java Generics . Implementing Java Generics Print Article Rough edges aside, see how the addition of Java Generics adds substantial expressive power to the Java programming language by Klaus Kreft and Angelika Langer Posted March 10, 2004 Editor's Note: This is the second of two installments presenting an overview of Java Generics, a new language feature that will be supported in the upcoming release of Java 2 Platform, Standard Edition . The first installment—"Language Features of Java Generics," Java Pro Online, March 3, 2004—discussed Java collections and generic treatment of types and classes. This concluding installment will look at generic treatment of methods as well as implementation and use of Java Generics. Types aren't the only components that can be parameterized. In addition to generic classes and interfaces, we can define generic methods. Static and nonstatic methods as well as constructors can be parameterized in pretty much the same way as we described parameterizing types previously (see "Language Features of Java Generics," Java Pro Online, March 3, 2004). The syntax is a little different, as you'll see. Everything said about type variables of parameterized types applies to type variables of parameterized methods in the exact same way. See Listing 1 for an example of a parameterized static method: max(). Parameterized methods are invoked like regular nongeneric methods. The type parameters are inferred from the invocation context. In our example, the compiler would invoke max() automatically. The type inference algorithm is significantly more complex than this simple example suggests, and exhaustive coverage of type inference is beyond the scope of this discussion. For the sake of completeness let's touch briefly on wildcards. So far we have been instantiating parameterized types using a concrete type that replaces the type parameter in the .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.