Object Oriented Programming - Lesson 8: Polymorphism and generic programming

Object Oriented Programming - Lesson 8: Polymorphism and generic programming Master the polymorphism technique, Understand the Java generic programming, Polymorphism, Downcasting and upcasting, Overloading, Method call binding, Generic programming. | LESSON VIII. Polymorphism and generic programming Trinh Thanh TRUNG (MSc) trungtt@ Objectives • Master the polymorphism technique • Understand the Java generic programming Content • • • • • Polymorphism Downcasting and upcasting Overloading Method call binding Generic programming I. DOWN CASTING AND UP CASTING Primitive type casting • Java performs automatic primitive type casting when: – Two types are compatible – The destination type is larger then the source type – Example: • int i; • double d = i; • We have to perform manual primitive type casting when: – Two types are compatible – The destination type is smaller then the source type – Example: • int i; • byte b = i; byte b = .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.