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