How are this() and super() used with constructors?
Answer Posted / sushila sonare
When we create an object, first constructor called. In a
constructor first statement should be either this() or
super(). If we didn't keep anything compiler kept super()
statement so constructor chain will be completed. Control
goes to Object class constructor and object creation will
completed. Suppose this() statement kept in constructor than
current class suitable constructor called and this chain
will be continue until control goes to Object class
constructor.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the advantage of preparedstatement over statement?
What are filterstreams?
How can we find the actual size of an object on the heap?
What is variable length arguments in java?
What methods are used to get and set the text label displayed by a button object?
What is the list interface in java programming?
Why array is used in java?
How to do a true java ping from windows?
What is main method?
State the main difference between c++ and java?
How many inner classes can a class have?
What is meant by method?
Can a constructor be private and how are this() and super() method used with constructor?
What is the purpose of tostring() method in java?
What does 0 mean in boolean?