Things about objects
jesse
jesse 2018-09-04 22:28:54
0
1
1361

What is the difference between using ordinary new and using the reflection class method to instantiate a class?

jesse
jesse

reply all(1)
小公

1. When using reflection, you must ensure that this class has been loaded and connected. When using new, this class may not be loaded or may already be loaded.

2. The new keyword can call any public constructor, while reflection can only call no-argument constructors.

3. The new keyword is strongly typed and relatively efficient. Reflection is weakly typed and inefficient.

4. Reflection provides a more flexible way to create objects and obtain object information. For example, the use of AOP in Spring and the use of dynamic proxies are all based on reflection. Decoupling

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template