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
How to sort a collection of custom Objects in Java?
Why is string class considered immutable?
What do you mean by Hash Map and Hash Table?
Define a package.
What is application tier?
Can I import same package/class twice?
What is generic class?
What is meant by main method?
What methods are used to get and set the text label displayed by a button object?
How can constructor chaining be done using this keyword?
What is update method called?
we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.
How many types of constructors are used in java?
Is 0 an even number?
Is java a utf 8 string?