Invoking constructor using java reflection.

Invoking non parameterized and parameterized constructors in java is possible thru reflection API. This helps the programmers to instantiate classes which are configured in a property file or in database on the runtime. Below given example demonstrate the power of jave reflection API, program creates instances using parameterized and non parameterized constructors.

Code snippet to invoke constructor using reflection

Complete Example

Leave a comment

Your email address will not be published. Required fields are marked *