mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-20 22:17:09 +08:00
Update reflection.md
This commit is contained in:
parent
8739559a36
commit
fdfa5c336b
@ -178,9 +178,10 @@ value is JavaGuide
|
|||||||
```
|
```
|
||||||
|
|
||||||
**注意** : 有读者提到上面代码运行会抛出 `ClassNotFoundException` 异常,具体原因是你没有下面把这段代码的包名替换成自己创建的 `TargetObject` 所在的包 。
|
**注意** : 有读者提到上面代码运行会抛出 `ClassNotFoundException` 异常,具体原因是你没有下面把这段代码的包名替换成自己创建的 `TargetObject` 所在的包 。
|
||||||
|
可以继续参考:https://www.cnblogs.com/chanshuyi/p/head_first_of_reflection.html
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Class<?> targetClass = Class.forName("cn.javaguide.TargetObject");
|
Class<?> targetClass = Class.forName("cn.javaguide.TargetObject");
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- @include: @article-footer.snippet.md -->
|
<!-- @include: @article-footer.snippet.md -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user