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
Which package is always imported by default?
What are the advantages of assembly language?
When parseint method can be used?
How to sort an unsorted array in java?
Are true and false keywords?
What does business logic mean?
What is the static variable?
What is int short for?
What is the symbol for average?
What does a method signature consist of?
How do I compare two strings in word in java?
What is thread safe in java?
What do you mean by data type?
In a container there are 5 components. I want to display all the component names, how will you do that?
What type of variable is gender?