Java中的String常量剖析(ZZ)
摘要: 常量池(constant pool)指的是在編譯期被確定,并被保存在已編譯的.class文件中的一些數(shù)據(jù)。它包括了關(guān)于類、方法、接口等中的常量,也包括字符串常量。
閱讀全文
posted @
2010-08-28 17:44 waynewan 閱讀(336) |
評(píng)論 (0) 編輯
java中的clone
摘要: Suppose you have an object ‘a(chǎn)’ of class ‘A’. Sometimes you may need another new object ‘b’. It also belongs to class ‘A’ and has the same data with object ‘a(chǎn)’. But if you do some modification on b, it has no effect to the value of ‘a(chǎn)’. We call this process which produced new object ‘b’ as clone object ‘a(chǎn)’. The commonest time that you need to clone an object is when it is a parameter or return value of one of your public methods. If it is a parameter that you save somewhere, then you don't want t
閱讀全文
posted @
2010-08-28 17:36 waynewan 閱讀(285) |
評(píng)論 (0) 編輯
Java中的Clone剖析(ZZ)
摘要: Java語言的一個(gè)優(yōu)點(diǎn)就是取消了指針的概念,但也導(dǎo)致了許多程序員在編程中常常忽略了對(duì)象與引用(此引用非C++中的引用)的區(qū)別,特別是先學(xué)c、c++后學(xué)java的程序員。并且由于Java不能通過簡單的賦值來解決對(duì)象復(fù)制的問題,在開發(fā)過程中,也常常要要應(yīng)用clone()方法來復(fù)制對(duì)象。比如函數(shù)參數(shù)類型是自定義的類時(shí),此時(shí)便是引用傳遞而不是值傳遞。
閱讀全文
posted @
2010-08-28 17:21 waynewan 閱讀(329) |
評(píng)論 (0) 編輯