Difference between this() and super() in java ?



Difference between this() and super() in java ?..

Answer / Shankar Kumar Goswami

Both this() and super() are used for calling constructors in Java, but they have different purposes. this() refers to the current class and is used to call another constructor within the same class. super() refers to the parent class and is used to invoke a constructor from the superclass.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

How do you sort an array in java?

1 Answers  


What is the differenc between Enemuration interface and iterator interface according to accessing?

4 Answers  


what is meant by Byte code concept in Java?

1 Answers   Aspire,


What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

1 Answers  


Does string is thread-safe in java?

1 Answers  


What is a Java Virtual Machine?

1 Answers  


Is cout buffered?

1 Answers  


What is the difference between a loader and a compiler?

1 Answers   Syntel, Visa,


how to prepare for IT Officers Interview in Banks

1 Answers   TATA, Tata Steel Limited,


Which api is provided by java for operations on set of objects?

1 Answers  


What is jit compiler in java?

1 Answers  


Are the equals() and hashCode() protected methods of object class?

1 Answers   Avaya,


Categories