java newinstance deprecated code example Example: java newinstance alternative YourClass.getDeclaredConstructor().newInstance()