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 do you differentiate abstract class from interface?
What is the set interface in java programming?
What do you mean by buffering?
What are thread groups?
How many bytes is a string?
When throw keyword is used?
What does %4d mean in java?
Can there be an abstract method without an abstract class?
What is arraylist class in java?
how can i use a nonsynchronized hashtable?
Can we declare array without size in java?
What is the difference between this() and super() in java?
What is the size of a string in java?
How can you generate random numbers in java?
How do you escape in java?