Java中的String常量剖析(ZZ)
摘要: 常量池(constant pool)指的是在编译期被确定,并被保存在已编译的.class文件中的一些数据。它包括了关于类、方法、接口等中的常量,也包括字符串常量。
阅读全文
posted @
2010-08-28 17:44 waynewan 阅读(322) |
评论 (0) 编辑
java中的clone
摘要: Suppose you have an object ‘a’ 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’. But if you do some modification on b, it has no effect to the value of ‘a’. We call this process which produced new object ‘b’ as clone object ‘a’. 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 阅读(270) |
评论 (0) 编辑
Java中的Clone剖析(ZZ)
摘要: Java语言的一个优点就是取消了指针的概念,但也导致了许多程序员在编程中常常忽略了对象与引用(此引用非C++中的引用)的区别,特别是先学c、c++后学java的程序员。并且由于Java不能通过简单的赋值来解决对象复制的问题,在开发过程中,也常常要要应用clone()方法来复制对象。比如函数参数类型是自定义的类时,此时便是引用传递而不是值传递。
阅读全文
posted @
2010-08-28 17:21 waynewan 阅读(314) |
评论 (0) 编辑