• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I think it should be false.

 
Roll
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Roll
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, Jim its given as true.
I could not see it.(May be iam sleepy).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic