Re: Few beginner questions,pls help

From: PerfectDayToChaseTornados (pdtct_at_emailaddress.invalid)
Date: 11/11/04

  • Next message: Mat: "Tomcat: edit error pages"
    Date: Thu, 11 Nov 2004 19:15:51 GMT
    
    

    -- 
    -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" <anon@penet.fi> wrote in message
    news:4190e9b6.30997902@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/developerworks/java/library/j-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)
    

  • Next message: Mat: "Tomcat: edit error pages"

    Relevant Pages

    • Re: Passing primitive variables by reference in JavaScript
      ... referred to by the same property, as your wrapper object has a property to ... to find it in order to modify and read its value. ... sense except as a marker because its value is a reference to the calling ... int main ...
      (comp.lang.javascript)
    • Re: Passing primitive variables by reference in JavaScript
      ... As I said, bad inference. ... referred to by the same property, as your wrapper object has a property ... to find it in order to modify and read its value. ... object reference as argument, it simply returns that reference without ...
      (comp.lang.javascript)
    • Re: Const parameter to function
      ... (or any methods that modify the object's state). ... public interface IImmutablePerson ... (which modifies the Name). ... full guarantees, I would say Clone that puppy, and pass the clone. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Synchronous Events?
      ... > Because an Event arg is a reference type. ... That means you can still modify the ... what I can go ahead and modify my event args ... and when it gets back from the Raise in the calling class, ...
      (microsoft.public.dotnet.languages.vb)
    • Re: byvalue or by refrence
      ... Matlab seriously lacks pass by reference method ... ... Nested function also has limited scope for emulating this behavior, ... This code has 4+4 byte oberhead, and solves the problem like modify ... function outvar = mynestedfunction ...
      (comp.soft-sys.matlab)