-3

What is the parameterized type of this Constructor in Java reflection?

java.lang.reflect.Constructor[] constructors = Stock.class.getDeclaredConstructors();

I've tried Constructor<Stock>[], Constructor<Stock.class>[], and Constructor<Class>[].

ThisClark
  • 14,352
  • 10
  • 69
  • 100

1 Answers1

1

The return type of getDeclaredConstructors() is <?> which is just any type.

Constructor<?>[] constructors = Stock.class.getDeclaredConstructors();

More info:
What does the question mark in Java generics' type parameter mean?

Community
  • 1
  • 1
ThisClark
  • 14,352
  • 10
  • 69
  • 100