
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Explore reflection in Java by examining objects and classes and retrieving detailed information, then invoke methods, instantiate classes, and access fields even for classes defined later.
Explore the Java class object by using getClass and Class.forName to obtain type objects, inspect super classes, wrappers, interfaces, primitives, and declared or enclosing classes through reflection.
Explore Java reflection by inspecting and invoking methods at runtime: obtain Method objects with getDeclaredMethod and getMethods, inspect names with getName, and invoke methods on objects.
Explore java reflection with the Field class to access, print, and modify specific class fields using get declared fields, get fields, and Field.set on an object.
Use reflection to obtain a class object's declared constructors with getDeclaredConstructors, iterate these constructor objects, and print each constructor's name for the Rectangle class.
Explore how reflection bypasses private and package-private access to fields and methods, using setAccessible, getDeclaredField, and getDeclaredMethod on a rectangle example to read and modify width and area.
Access solutions for each coding exercise, and request additional explanations; we will create a short video clip with further exploration.
Learn about Java Reflection advanced capabilities. Don't settle with the basics. Learn how to write code that explores objects and classes during runtime, indirectly invokes methods and indirectly access fields, and indirectly instantiates classes (even when the case involves a class that was created long after your code was written). In addition, learn how we can use reflection for overriding accessibility constraints, such as the private access modifier. Take this course and leverage your Java programming skills to the next level.