Core Java Interview Questions – this Keyword

This Core Java Interview Questions-This keyword page provides all core java interview questions about “this” keyword including the need of this keyword, what this keyword holds, what is the use of this method, need to this method, constructor chaining and much more.

What is “this” keyword in java?
“this” keyword is pre defined non-static variable.

What “this” keyword holds?
Current Object address.

Where we use “this” keyword?
Only inside the non-static context.

What is the use of “this” keyword?
Used to access static and non-static members.

What is this() method?
Used to access current class constructor explicitly.

Where we use this() method?
It must be used inside another constructor of the same class.

What is constructor chaining?
Connecting more than one constructor inside the class or in parent-child relation.

Can we connect more than one constructors from one constructor?
No, call to this() must be the first statement in the constructor.

Can we print object address using “this” keyword?
Yes allowed but only in non-static context.

>Core Java Interview Questions-Inheritance<

Share this