--
-P
"Programs that are hard to read are hard to modify.
Programs that have duplicated logic are hard to modify.
Programs with complex conditional logic are hard to modify"
( Kent Beck)
"onTilt" <an**@penet.fi> wrote in message
news:41***************@news.htnet.hr...
| Hi,
| I have few questions and doubts,so please help:
|
| Is it true that Runtime class holds runtime information on all
| objects?
No
http://java.sun.com/j2se/1.4.2/docs/api/
|
| Is it true that a subclass has more, or equal amount of functionality
| when compared to its superclass?
Yes
|
| When i am checking two objects for equality, what are four
| characteristics that i must check?
http://www-106.ibm.com/developerwork...-jtp05273.html
|
| I am not clear about the difference between copying and cloning,is
| there any difference at all? if so, is there a risk when cloning?
Yes there is a huge difference.
Imagine you have an object A which contains a reference to object B,
if you copy object A to object C, then you have a new object - object C, but
object C still has a reference to object B. This may not be what you
require.
Now imagine that you override object A's clone method & in this method you
set it's reference to object B to a new object of the same type as B & copy
B's data into it. Now you clone object A to object C, then C no longer has a
reference to object B, but to a new object with the same data which was in
object B.
The difference here is that if the copied object C modifies object B this is
the SAME object B that object A points to, so both object A & C now have the
same modified data in object B.
With the cloned object C, if it modifies its NEW referenced object of the
same type as B, then it has no effect on object B (as it is modifying the
new Object created in its clone() method), so the objects (which are of the
same type as B) referenced from A & C now contain different data.
In the future try posting to comp.lang.java.help, it is a much higher
traffic group than this one :-)
--
-P
"Programs that are hard to read are hard to modify.
Programs that have duplicated logic are hard to modify.
Programs with complex conditional logic are hard to modify"
( Kent Beck)