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 :: operator in java?
Difference between current previous versions of Java?
How do you define a set in java?
State some advantages of java?
How the metacharacters are different from the ordinary characters?
What are the 2 types of java programs?
What is final class?
What is difference between fileinputstream and filereader in java?
How to make a class or a bean serializable?
String class is defined under which package in java?
What loop means?
How does a cookie work in Servlets?
Define Multiprogramming and Multiprocessing in java.
How to reverse a string in java?
Write a java program for binary search?