Example & Tutorial understanding programming in easy ways.

What are the disadvantage of using the reflection API?

1 Reflection involves types that are dynamically resolved. As a result, certain optimizations can not be performed by the JVM. This can result in slower execution.
2 Reflection can be used only when the caller has the right permissions.
3 Reflection can compromise the access rules of objects such as being able to access the private or protected members. This may result in unexpected behavior or it may     render the code dysfunctional or platform specific.

4 Reflection is powerful, but should not be used indiscriminately. If it is possible to perform an operation without using reflection, then it is preferable to avoid using it.

Read More →