It makes no sense to call newInstance().getClass() , because it will give the same Class instance where it was created from.
Rather, it creates an additional instance that will be immediately deleted. Even this will not work if the class does not have a default constructor.
In addition, the cost of creating, initializing, etc. may be wonderful.
source share