The greatest benefit of Java reflection is the ability to get the structure, member variables, and instantiation of a class during run time.
The following are specific usage scenarios: if we had two programmers, a programmer would need to use the class written by the second programmer while writing the program, but the second programmer did not complete the class he wrote. So can the first programmer's code be compiled? This is not possible by compiling. Using the mechanism of Java reflection, the first programmer can compile the code without getting the class that the second programmer wrote. The reflection mechanism of Java it knows the basic structure of the class, this ability to explore Java class structure, we call Java class "self-audit". Everyone has used JCreator and eclipse. When we build an object, we call the method and properties of the object. At the click of a point, the compilation tool automatically lists all the methods and properties that the object can use for the user to select. This is the use of the principle of Java reflection, is to create the object of our discovery, self-examination.
Excerpted from https://zhidao.baidu.com/question/1435999620760135379.html
Why Java uses reflection (easy-to-understand examples)