java.lang.reflect.*

Write Dynamically Reusable Code in Java

As a Java programmer, if we know how reflection works, we can save a lot of time and effort. Instead of writing versions of the same code over and over again, we can write a single method that does what we want in a general way. In this course we start with the basics, then show how reflection works with the more modern language features such as sealed classes and records. We also show how arrays can be manipulated and created via reflection. Lastly, we show MethodHandle and VarHandle. Learn from hands-on exercises that are followed by demos revealing the solutions.

Benefits of Course

  • Save programming time by writing dynamic solutions to reoccurring problems.
  • Learn how dynamic coding via reflection affects Java performance and correctness.
  • A well-rounded Java programmer should know reflection, when to use it, and more importantly, when not to use it.

What you'll learn and how you can apply it

By the end of the course, you'll understand:

  • Basic reflection: Class, Method, Field, Constructor
  • More advanced reflection concepts: generics, records, sealed classes, nested classes, modules
  • Deep reflection in Java, which allows changes to private final fields
  • How to manipulate arrays with reflection
  • MethodHandle and VarHandle

And you'll be able to:

  • Inspect a class and find methods, fields and contructors at runtime
  • Call methods, change fields, even if they are private
  • Write more general code that can be reused in many different contexts
  • Understand VarHandles and MethodHandles and know when to use them
  • Know how sealed classes and records can be inspected via reflection

This course is for you because...

  • You want to be considered a guru by your colleagues and peers, writing "magical" Java code that dynamically adapts itself to change.
  • You want to save time in your development by writing highly reusable code.
  • You are in the top tier of developers and want to learn how to write libraries and frameworks

Who should take this course?

  • Students should be very familiar with Java 11, understanding data structures, object orientation, recursion and modern Java syntax.
  • Prior experience with reflection is a bonus, but not necessary.

Your Instructor


Dr Heinz M. Kabutz
Dr Heinz M. Kabutz

Heinz Kabutz is the author of The Java Specialists’ Newsletter, a publication enjoyed by tens of thousands of Java experts in over 150 countries. He has been a Java Champion since 2005.


Course Curriculum


  0. Resources
Available in days
days after you enroll

Frequently Asked Questions


How long do I have access to a fully paid course?
How does lifetime access sound? After enrolling, you have unlimited access to this course for as long as you like - across any and all devices you own. Furthermore, if we move to another platform, we will offer you a free transfer of your account for all the courses that you have purchased.
How many times can I cancel and rejoin a subscription course?
To prevent abuse, we limit the number of times that you can cancel and rejoin our subscription based courses to three times.
What is the difference between a subscription, paying in installments and an outright purchase?
With a subscription, you never own the rights to the material. If your card is declined or you cancel your subscription, you lose access to the course. The money you have paid so far is lost. Paying in installments is a bit better. You pay for 5 or 10 months and then once you have completed your installments you have lifetime access to the course. The safest is an outright purchase, where you pay the entire course in one amount. There is no risk of losing access.
Can I pay via PayPal?
Yes, you can for outright purchases, but not for recurring payments such as paying by installments or subscriptions.
Can I get an EU VAT Invoice?
Absolutely. First off, be sure to enter the VAT number in the appropriate field during the payment process. Then contact us for an EU VAT Invoice. Please tell us the receipt number for which you need the invoice.
May I share my login details with my colleagues?
Unfortunately not. The terms of usage are for a single license. Teachable tracks your progress through the curriculum, so you won't know how much you have watched. We offer a 30% discount on 50 licenses or more by one company. Please contact us for bulk licensing.
May we use the course for running in-house courses?
You may, as long as each of the students in the class has a valid license for that course. For example, some companies run lunch time Design Patterns study groups using our material. This is an effective way to learn. Please contact us for bulk licensing.
What if I am unhappy with the course?
We would never want you to be unhappy! If you are unsatisfied with your purchase, contact us in the first 30 days and we will give you a full refund and deregister you from the course.
When does the course start and finish?
The course starts now and never ends! It is a completely self-paced online course - you decide when you start and when you finish. We do recommend putting time aside and setting goals to complete the course.
Can I watch the course offline during my commute?
Teachable have an iOS app that lets you watch offline. Android is not supported unfortunately.

Thank you so much for your interest in this course. If you have any questions, please contact Heinz Kabutz.

Get started now!