SCJP-1.5<br />SCWCD-1.4
Best Wishes,<br /> Yeming
cmbhatt
SCJP-1.5<br />SCWCD-1.4
Originally posted by dolly shah:
Thanks both of you.
But I am confuse about Constructor chaining which is written in K & B book, chapter-2, page-128. It shows, constructor invoked then instance variable then constructor completes. I am not getting this chaining.
Can you explain please?
Best Wishes,<br /> Yeming
cmbhatt
constructor invoked then instance variable then constructor completes
Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Originally posted by sumi selva:
I would like to know, from where the getFeet() method is called. It is only a method and not a static block.
Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Originally posted by Raghavan Muthu:
When it comes to the initialiazing of superclass through constructor chaining, the instance variable "i" of superclass has to get the value by calling the method "getFeet()" (as per the code). Obviously, you can call ONLY the static method(s) during or within the constructor because to invoke an instance method, there is "NO" object existing and thats what you are doing it now.
Best Wishes,<br /> Yeming
SCJP-1.5<br />SCWCD-1.4
cmbhatt
Originally posted by dolly shah:
Yeming, Thanks for explanation. But Is this not a method call before supertype constructor has been called?
Animal(){
this(getFood());
System.out.println("No-arg constructor completes");
}
Can you explain little more? I am not getting exactly.
Best Wishes,<br /> Yeming
SCJP-1.5<br />SCWCD-1.4
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |