"If you fail to plan, you plan to fail."<br /> <br />Chad<br />SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3<br />SCDJWS (next)
Regards,<br />Seb<br /> <br />SCJP 1.4
"If you fail to plan, you plan to fail."<br /> <br />Chad<br />SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3<br />SCDJWS (next)
Originally posted by Ritu Kapoor:
...So during compilation time , variable a is assigned a default value 0 and hence on displaying sup.a, you get 0. [/QB]
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Originally posted by Seb Mathe:
1. new Sub()
2. Super instance init : a = f()
3. f() is found in B -> return b
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
1. Can a super class call its own child's method??
2. Is there anything like if a method is not available in the parent class it would search them in the child classes??? How does the parent class know that it has so and so number of children???
Regards,<br />Seb<br /> <br />SCJP 1.4
variable a is assigned a default value 0 and hence on displaying sup.a, you get 0
Regards,<br />Seb<br /> <br />SCJP 1.4
Originally posted by Seb Mathe:
When System.out.ptintln(sup.a) is called, a has been assigned to the return of the call to f()...
You can have a child object in a parent reference. Using such a reference to access the method, would search the called method in parent class only.
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Regards,<br />Seb<br /> <br />SCJP 1.4
Regards,<br />Seb<br /> <br />SCJP 1.4
You can have a child object in a parent reference. Using such a reference to access the method, would search the called method in parent class only.
Regards,<br />Seb<br /> <br />SCJP 1.4
You can have a child object in a parent reference. Using such a reference to access the method, would search the called method in parent class only.
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
You can have a child object in a parent reference. Using such a reference to access the method, would FIRST search the called method in parent class.
1. If the function doesnt exist in parent class, its a compile time error.
2. If the function exists in parent class and is overridden in child class, then based on "object type" child's overridden copy is called.
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Don't get me started about those stupid light bulbs. |