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 port number in java?
Is a copy constructor?
What are keywords in programming?
How do you include a string in java?
Does unicode support all languages?
What is var keyword ?
Give any two differences between C++ and java.
Can you declare an interface method static?
Explain what is Marker interface?
Why string is called as immutable?
What are some characteristics of interference class?
Can we sort list in java?
What is the use of jtable?
How do you implement polymorphism in our day to day life?
What is listnode in java?