- 浏览: 747598 次
- 性别:
- 来自: 上海
-
文章分类
- 全部博客 (419)
- 杂软粉墨 (2)
- 创意灵感 (3)
- 经验记录 (137)
- 开源轨迹 (2)
- sip-communicator (2)
- 闲侃杂谈 (8)
- 问题交流 (24)
- 概念模式 (32)
- 难点备案 (5)
- JwChat (1)
- 中国象棋 (1)
- 教育探索 (6)
- 英语研究 (58)
- 星际争霸 (1)
- 电信知识 (1)
- 软件架构 (3)
- 哲学探索 (26)
- 算法灵魂 (8)
- 近视探索 (6)
- 数学数学 (3)
- 牛角钻尖 (23)
- 至强文言 (3)
- 数据结构 (1)
- 宇宙物理 (2)
- 网络架构 (3)
- 游戏领域 (4)
- 图形处理 (2)
- 修炼之路 (8)
- 读书天地 (20)
- 编解乱码 (2)
- 概念探索 (8)
- 格物致知 (1)
- 其它语言 (1)
- 测试领域 (3)
- 文化风流 (1)
- JQuery (1)
- 網頁領域 (1)
- Unix/Linux (1)
- Inside JVM (1)
- 异常分析 (1)
最新评论
-
suyujie:
引用
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
iamzhoug37:
您能说一下"局部变量不受文本顺序限制" 是 ...
声明前为什么能赋值却不能输出,都是使用
my workmate told me such a senario, there're two objects, which are instantiated in a local method, respectively assigned to local variables. A class has a type B field, B class has a type A field, and their instances, each has other's instance, the following program illustrates:
class A { B b; public A() { System.out.println("constructing a"); } public void finalize() { System.out.println("finalize a"); } } class B { A a; public B() { System.out.println("constructing b"); } public void finalize() { System.out.println("finalize b"); } } public class Test { public static void main(String[] args) { new Test().go(); } public void go() { A a = new A(); B b = new B(); a.b = b; b.a = a; try { a = null; b = null; System.gc(); Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } } public void finalize() { System.out.println("finalize Test"); } }
guess what? as we may reasonably guess: even if the method finishes, each instance has been referenced by the other one at least, so they wouldn't be garbage collected, right? but the actual result is:
constructing a
constructing b
finalize b
finalize a
they are both garbage collected even if they may still be referenced. WHY ?
primary conclusion may be they two as a whole has been treated a one object which's no longer be referenced, so they get garbage collected.
发表评论
-
NullPointerException in ternary operator
2013-01-19 00:01 1122java代码: Integer i = null; ... -
why concrete class must implement abstract method while abstract class need not
2011-05-11 13:27 1515yes, just as the title...why co ... -
Enum singleton - Elvis Stealer
2011-04-26 14:41 1634import java.io.ByteArrayInputSt ... -
why can inner class be instantiated in this way?
2011-04-06 10:24 1019public class Outer { pub ... -
into native source code
2011-03-23 23:09 964once there was a problem occurr ... -
about Thread.join method
2011-03-23 08:09 1274import java.util.Timer; import ... -
why is static inner class singleton thread safe?
2011-03-15 09:03 1455http://en.wikipedia.org/wiki/In ... -
why string concatenation yields no interned one
2011-03-14 16:48 1112public class Test { public st ... -
why can bit mask suppress sign extention
2011-03-10 09:16 1179yes, bit mask can suppress sign ... -
circumvents exception checking
2011-03-03 11:02 965import java.io.IOException; ... -
关于维基中singleton pattern的一段
2011-02-24 10:00 1092Another notable difference is t ... -
why List hasn't clone method but the ArrayList has
2011-02-16 15:27 1170List list = new ArrayList(); ... -
deep copy
2011-02-16 15:20 1039static public Object deepCopy(O ... -
Java is Pass-by-Value
2011-02-14 13:28 1092This often heard saying is not ... -
不是说字符串不可变吗
2011-02-14 11:28 896from csdn: http://topic.csdn.ne ... -
没有实现抽象方法的具体类居然编译通过了
2011-02-04 22:29 973来自csdn: http://topic.csdn.net/ ... -
关于iterator的fail-fast
2011-01-20 11:15 996是使用集合的iterator后,再改变就可能抛出这个异常 ... -
生成几个String的问题
2011-01-11 16:26 1011public class Test extends java. ... -
无符号右移>>>
2011-01-11 15:46 2342public class Test { public st ... -
Struts2之log信息不出的问题
2010-12-30 11:18 3020刚开始学习Struts2的时候,用的是maven方式,但是却不 ...
相关推荐
Find out Stored Procs Which Referenced Specified TableName
- See all assets not being referenced by any other asset so you can delete them all without worrying about breaking any references. - GUID Tools Advanced tool where you can see GUID of each asset ...
all tests are applicable to BSS meeting Phase 2 and/or Phase 2+ GSM requirements, because the requirements of the Phase 2 and Phase 2+ core GSM specifications which are referenced in the test are ...
- See all assets not being referenced by any other asset so you can delete them all without worrying about breaking any references. - GUID Tools Advanced tool where you can see GUID of each asset ...
Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...
- **Surrogate Objects and Forwarding and Inheritance:** Surrogate objects can be used to intercept messages and handle them on behalf of other objects. This is useful for implementing proxy patterns ...
- **Events**: Events allow objects to notify other objects of changes or actions. This section covers how to define and handle events. - **Anonymous Methods**: Anonymous methods are methods without ...
**Question:** Which three are true statements about dependent objects? (Choose three) - **A:** Invalid objects cannot be described. - **B:** An object with a status of invalid cannot be a referenced ...
spring-framework-3.1.1.RELEASE jdk1.7 环境下 can't find referenced pointcut 问题解决 换了对应的jar文件即可 aspectjrt.jar aspectj-1.6.6.jar aspectjweaver.jar
and is referenced frequently to this day. (See Duda & Hart, for example.) The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant. One class is ...
referenced in each Component Technical Specification (CTS) or Subsystem Technical Specification (SSTS). It is intended to be a guideline when creating a CTS/SSTS, and a guideline for suppliers when ...
firing again and to prevent other wake GPEs from interrupting the wake process. Added the AcpiGpeCount global that tracks the number of processed GPEs, to be used for debugging systems with a large ...
are assumed to be co-referenced (clustered), with the same "E" type ID or the same "NIL" ID if they refer to the same entity. Each "E" type ID and NIL ID is distinct from one another. 3. entity-...
Allows to hold KeyValue and Text as not affecting to each other values. Take effect when KeyField, ListField, ListSource, DataField and DataSource properties is empty. Drop down list can: Show ...
An isolation level determines the degree to which data is isolated for use by one process and guarded against interference from other processes. Prior to SQL Server 7.0, REPEATABLE READ and ...
Allows to hold KeyValue and Text as not affecting to each other values. Take effect when KeyField, ListField, ListSource, DataField and DataSource properties is empty. Drop down list can: Show ...
Allows to hold KeyValue and Text as not affecting to each other values. Take effect when KeyField, ListField, ListSource, DataField and DataSource properties is empty. Drop down list can: Show ...
These objects allow the user to create and manipulate the elements of these C structures, and these objects are then passed as parameters to the perl version of these tuxedo C functions. * buffer ...
Allows to hold KeyValue and Text as not affecting to each other values. Take effect when KeyField, ListField, ListSource, DataField and DataSource properties is empty. Drop down list can: Show ...
4.1 You are responsible for paying all applicable taxes and other costs you may incur in connection with your use of the Software including but not limited to all hardware and software costs and ...