8000 Update reflection.md · codeyu/JavaGuide@880226e · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 880226e

Browse files
authored
Update reflection.md
1 parent c37d4f2 commit 880226e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/java/basic/reflection.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ I love JavaGuide
104104
value is JavaGuide
105105
```
106106

107+
**注意** : 有读者提到上面代码运行会抛出 `ClassNotFoundException` 异常,具体原因是你没有下面这段代码的包名替换成自己创建的 `TargetObject` 所在的包 。
108+
109+
```java
110+
Class<?> tagetClass = Class.forName("cn.javaguide.TargetObject");
111+
```
112+
113+
107114
### 静态编译和动态编译
108115

109116
- **静态编译:** 在编译时确定类型,绑定对象

0 commit comments

Comments
 (0)
0