Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes I think it should be false. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "I think it should be false." Watch "I think it should be false." New topic
Author

I think it should be false.

Roll
Ranch Hand

Joined: Jan 20, 2000
Posts: 52
This question was posted in the other disc.. group.
Constructor invokation occurs from the current class up the hierarchy to the ancestor class.Is this true.
Any comments.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I'd say it's true. If you have
class A {}
class B extends A {}
class C extends B {}
then the constructor for C invokes the constructor for B, which in turn invokes the constructor for A. That's how I interpret the question anyway. Why do you think it should be false?


"I'm not back." - Bill Harding, Twister
Roll
Ranch Hand

Joined: Jan 20, 2000
Posts: 52
Hey Jim,I think the other guy must have been posted this question from Marcus Mock Exam 3.
Now when iam going through Marcus Mock Exam 3 i saw this question and the answer given was false.Question 43)
Which of the following statements are true
1) constructors cannot be overloaded
2) constructors cannot be overriden
3) a constructor can return a primitive or an object reference
4) Constructor invokation occurs from the current class up the hierarchy to the ancestor class

---Answer to Question 43)
2) constructors cannot be overriden
4) constructors must have the same name as the class they "construct"
Overloading constructors is a key technique to allow multiple ways of initialising classes. By definition constructors have no return values so option 3 makes no sense
http://www.software.u-net.com/javaexam/exam3.htm
Roll
Ranch Hand

Joined: Jan 20, 2000
Posts: 52
Sorry, Jim its given as true.
I could not see it.(May be iam sleepy).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I think it should be false.