https://junwang666.github.io/p/250719_java3_lite/ #1
Replies: 1 comment
-
|
test |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://junwang666.github.io/p/250719_java3_lite/
内存管理与对象模型 自动垃圾回收(GC) Java通过JVM的垃圾回收机制自动管理内存,开发者无需手动释放对象。所有对象通过new在堆上创建,生命周期由GC决定。例如:\n1 2 3 4 public void javaMethod() { MyClass obj = new MyClass(); // 对象在堆上创建 // 使用obj... } // 方法结束后,obj引用不再可达,GC会在未来某个时间回收内存 引用类型对象模型 Java中所有非基本类型(如int、double)的对象变量存储的是堆上对象的引用(可视为安全的指针)。与C++不同,Java不允许在栈上直接创建对象实例:\n
https://junwang666.github.io/p/250719_java3_lite/
Beta Was this translation helpful? Give feedback.
All reactions