Lecture 7 - Language Features
Lecture 7 - Language Features
Senior-lecturer
[email protected]
Astana IT University
▪ Run-Time Type Identification (RTTI)
▪ Reflection
▪ Generics
▪ Lambda Expressions
▪ Default methods in Interfaces
▪ Static methods in Interfaces
▪ Although polymorphism and dynamic binding are powerful
tools, they are not sufficient to take care of all the issues that
arise when dealing with an inheritance hierarchy.
▪ Consider having classes as Shape, Circle, Rectangle and
ShapeList which has several shapes. What if we need to
calculate a quantity of circles in a ShapeList?
▪ instanceof operator
▪ Downcasting
▪ Anything else?
▪ Reflection allows an executing Java program to examine or
"introspect" upon itself, and manipulate internal properties of the
program
▪ Based on the notion of a special class known as Class
▪ A reference to Class can be obtained using the getClass() method