Files
Hui-s-notebook/logseq-java/pages/static.md
2024-02-02 00:12:49 +08:00

10 lines
655 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
- static静态
- > 如果一个方法写了static表示这个方法是一个静态方法
- [[对象]]的行为和属性是可以动态改变的
- 如果一个方法没有使用static定义的方法属于[[动态方法]]
- 如果一个方法不能和任何一个对象挂靠,就应该是个[[静态方法]]
- static静态属性存储在[[元空间]]中,且与此类型对象无关,只与类有关,这种属性也称为[[类属性]]
- 如果是static属性则在调用时无需[[new]]
- 静态方法不能直接调用动态方法,需要使用 [[new]]
- 静态方法可直接调用静态方法
- 动态方法可以直接调用静态方法