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
Can we extend private class in java?
Is java free for commercial?
Can we declare a class as abstract without having any abstract method?
What is anti pattern in programming?
What are the different tags provided in jstl?
Is java type safe?
Explain with example the concept of constant variable in java.
What is an exception in java?
What is e java?
Can we override the private methods?
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.
What is callablestatement? How you can call stored procedure to pass in parameter?
What is the difference between assignment and initialization?
Which class should you use to obtain design information about an object in java programming?
What are the drawbacks of reflection?