title: Java: creating a new object with unknown type
body: <p>Is there any way in java to store the type of an object in a variable? Like if I wanted to get a class type as a parameter and then return the correct type of object. </p>