JAVA - Create object from generic class : I want to create objects from different classes extending the same class. Can you explain how it will work. Examples would be nice.

Thank you. 


    class MainClass{

       private <T extends DataPoint> void someMethod(Class<T> clazz) {
          new clazz();//<-- create object of class (did not work)
       }

       private void anotherClass(){
          someMethod(GreenDataPoint.class);
          someMethod(BlueDataPoint.class);
       }
    }

    class DataPoint {...}

    class BlueDataPoint extends DataPoint {...}

    class GreenDataPoint extends DataPoint {...}