Difference between revisions of "IT-SDK-Java-Plus"
Jump to navigation
Jump to search
Samerhijazi (talk | contribs) (Created page with "* Dynamically create a new instance using reflection") |
Samerhijazi (talk | contribs) |
||
| Line 1: | Line 1: | ||
| + | * How to avoid hardcoding the class name (advanced pattern) | ||
* Dynamically create a new instance using reflection | * Dynamically create a new instance using reflection | ||
| + | * return getClass().getConstructor(String.class).newInstance(newName); | ||
Latest revision as of 18:25, 30 May 2025
- How to avoid hardcoding the class name (advanced pattern)
- Dynamically create a new instance using reflection
- return getClass().getConstructor(String.class).newInstance(newName);