Difference between revisions of "IT-SDK-Java-Plus"

From wiki.samerhijazi.net
Jump to navigation Jump to search
(Created page with "* Dynamically create a new instance using reflection")
 
 
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);