tailieunhanh - 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 = .

TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN