Using the class type of an object to create a new instance : <p>I call a method with the signature <code>save(Object o)</code> this way:</p>

<pre><code>EntityManager em = new EntityManager(); // My own EntityManager
User user = new User(); // Constructor provides values
em.save(user);
</code></pre>

<p>In the save-method I need to instantiate a new object, in this case it would be of type <code>User</code> this way: <code>User user = (User) o;</code></p>

<p>Well, so far I can extract the class of the object with <code>o.getClass()</code>, which delivers <code>class org.example.User</code>, which is <code>User.class</code> I guess. But I can't figure out how I could realize the line <code>User user = (User) o;</code> with that.</p>
